Code: Select all
n|32>>1
Code: Select all
(n|32)>>1
Code: Select all
n=4
Debug (n|32)>>1
Debug n|32>>1
Also, if anyone knows how I can overcome this without the feature request (which could take some time if ever) please, post in here

Code: Select all
n|32>>1
Code: Select all
(n|32)>>1
Code: Select all
n=4
Debug (n|32)>>1
Debug n|32>>1
It compiles because the result goes to n.netmaestro wrote:This compiles without problems:
Code: Select all
n|32>>1
Yes. The reason is that this is an expression only, but therenetmaestro wrote:Is there a reason why this shouldn't compile too?Code: Select all
(n|32)>>1
It already works with macros:netmaestro wrote:Surely macros would be much more flexible if you could begin a line with brackets. I'm currently working on some SHA2 implementations and there's some pretty fancy bitshifting involved. If this worked it would simplify things a lot. Thanks for listening!
Code: Select all
Macro doIt(n)
(n|32)>>1
EndMacro
x = doIt(12)
Code: Select all
Macro doIt(n)
(n|32)>>1
EndMacro
doIt(12)
They were written by Christopher Devine. I'm not too proud to learn, if there's anything you can offer. Thanks in advance.#define SHR(x,n) ((x & 0xFFFFFFFF) >> n)
#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
Just straight forward:netmaestro wrote:Thanks! I appreciate the help. Maybe you can show me how to convert these c macros to Purebasic and I'll be eternally grateful:They were written by Christopher Devine. I'm not too proud to learn, if there's anything you can offer. Thanks in advance.#define SHR(x,n) ((x & 0xFFFFFFFF) >> n)
#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
Code: Select all
;#define SHR(x,n) ((x & 0xFFFFFFFF) >> n)
Macro SHR(x,n)
((x & $FFFFFFFF) >> n)
EndMacro
;#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
Macro ROTR(x,n)
(SHR(x,n) | (x << (32 - n)))
EndMacro
x = SHR(%1000,2)
Debug Bin(x)
x = ROTR(%1000,7)
Debug Bin(x)