Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ones complement shifting
#1
I'm assuming that shl and shr are twos complement shifters. Does Freebasic also have a ones complement shift-right (>>> in C-based languages)? I can always resort to using ASM...END ASM, but if FB has an operator... hey, nifty.

Also, does Freebasic report overflows on left shifts, or does it gracefully knock off the bits? My knowledge of x86 assembly is limited on these types of siilly nitpick questions.

Actually, my knowledge of x86 assembly is just plain limited, but I'm a quick learner.
Reply
#2
If the left operand is unsigned then no arithmetic shift will be done. You can also use cunsg() to "convert" the operand to unsigned, so mul, div, shift, conversions will be done for unsigned types.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)