Jump to content

Recommended Posts

We should have some nodes to do quick and dirty arithmetic and logic checks.

 

For all the following, Stuff Done Flags is the result, Extra 1x is Input A, and Extra 2x is Input B.

 

  • SDF_ADD: Add SDF A and SDF B, store the result in Stuff Done Flags (A+B)
  • SDF_SUB: Subtract SDF A into SDF B, store the result in Stuff Done Flags (A-B)
  • SDF_MULT: Multiply SDF A and SDF B, store the result in Stuff Done Flags (A*B)
  • SDF_ADD: Devide SDF A into SDF B, store the result in Stuff Done Flags, rounded down (floor(A/B)
  • SDF_POW: Raise SDF A by SDF B, store the result in Stuff Done Flags (A^B) (will SDF limits be a concern?)

 

All of the following assume 0 or -1=FALSE, any other =TRUE

 

  • SDF_AND: Logical AND
  • SDF_OR: Logical OR
  • SDF_NOT: Logical NOT (ignoring SDF B)
  • SDF_NAND: Logical NAND
  • SDF_NOR: Logical NOR
  • SDF_XOR: Logical XOR
  • SDF_XNOR: Logical XNOR

 

With a bit of elbow grease this could allow designers to implement some logic beyond what we have now.

Link to comment
Share on other sites

Definitely agree, with one exception: I doubt we need logical XOR or XNOR. Actually, logical XNOR already exists - it's called "SDF Equal". :p (I suppose it could differ in treating the SDFs as boolean instead of numeric...)

 

I expect the SDF limit can be dropped entirely, but I'm not sure your logic of where to store the result is good. Why not just use the "pic" field for the result SDF?

 

EDIT: Sorry, "pic" is one field and SDFs need two. Maybe the "message" fields, then. That said, I guess it doesn't particularly matter.

Link to comment
Share on other sites

  • 7 months later...

Thinking over this again, I think logical AND and OR are completely unnecessary - can't you get the same effect by simply chaining nodes together in the right way?

 

The arithmetic ones I'm currently in the process of adding. They'll probably work like this:

 

SDF1, SDF2 - Output SDF (for division, the quotient)

Ex1a, Ex1b - Input SDF (left operand) - if ex1b is negative, takes ex1a as a literal value

Ex2a, Ex2b - Input SDF (right operand) - if ex2b is negative, takes ex2a as a literal value

Ex1c, Ex2c - For division only, output SDF to store the remainder.

 

EDIT: Note - due to the implementation of pointers, the only guaranteed way for ex1a or ex2b to be negative would for it to have been set to -1; other values might get replaced by pointed-to values.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...