ZBrushCentral

Bitshifting only works for 16 bit ops

I have unfortunately wasted a day trying to get some code to work. I realized that the bitshifting opperations only allow up to 16bit shifts.

Hopefully I am wrong.... if so, please show us how. if I am correct, Please Put this on your bug fix list. I created a little shifting routine that fixes it if anyone wants to use it.
//[VarDef,shftOUT,0]//this needs to be defined somewhere in the scope of the working code
       [RoutineDef,SHFTBTSL,
       	[VarSet,x,1]
       	[Loop,p,
       		[VarMul,x,2]
       	]
       	[VarSet,shftbtsOUT,x]//Name This As A Global Var
       ,p]
     //this shifts bits to the left only, change VarMul to VarDiv for Rt
       
To use it just : [RoutineCall,SHFTBTSL,2] this is equivolent to (1<<2)

your global variable shftbtsOUT will be filled with the val.
You can then use |,&, etc. It will stay 32bit for these ops.

Sorry if I sound cranky, not a lot of sleep lately.:mad:

Hi:)
The “<<” is a 16.16 bitwise operator. For larger values, you may want to use the power ("^^") function.

ie. var1 raised to the power of var2 is written as “var1^^var2”

Examples:

[VarMul, theVariable , 2^^shiftValue ]

[VarSet , theVariable , theVariable*(2^^shiftValue) ]

b can be written as (10*(2^^20))

Hope this helps,
-Pixolator

…Pixo himself gives you private lessons :smiley:
Pilou

Thanks again,
Sorry to be such a pickle.

Hey…I was wondering where the power function was.:wink:
(Just found it in the online reference)

good to know, thanks again.

Chris

Pixolator,
Are all of the bit operators only 16.16.
I am getting some strange discrepencies in my numbers.

I will look into it some more. I will make a dll to check it with.

Thanks,

Chris Reid