SPL to HP C/XL Migration Guide (30231-90001)

5-15
Figure 5-13. HP C/XL DLSR Directive: Bit Shift Operation
_________________________________________________________
| |
| #define DASL(X,C) ((int)(((int)X & 0x80000000) | \|
| ((int)X << (C)) & 0x7FFFFFFF)) |
_________________________________________________________
Figure 5-14. HP C/XL DASL Directive: Bit Shift Operation
_______________________________________________
| |
| #define DASR(X,C) ((int)((int)X >> (C)))|
_______________________________________________
Figure 5-15. HP C/XL DASR Directive: Bit Shift Operation
_________________________________________________________
| |
| unsigned int DCSL(X,C) |
| unsigned int X; |
| int C; |
| { |
| for (;;--C) /*infinite loop, decrementing C after each iteration*/|
| { |
| if (C == 0) return(X); /*exit, returning X*/ |
| X = ((X & 0x80000000) >> 31) | X << 1; |
| } |
| } |
__________________________________________________________________________
Figure 5-16. HP C/XL DCSL Function: Bit Shift Operation
__________________________________________________________________________
| |
| unsigned int DCSR(X,C) |
| unsigned int X; |
| int C; |
| { |
| for (;;--C) /*infinite loop, decrementing C after each iteration*/|
| { |
| if (C == 0) return(X); /*exit, returning X*/ |
| X = ((X & 0x00000001) << 31) | X >> 1; |
| } |
| } |
__________________________________________________________________________
Figure 5-17. HP C/XL DCSR Function: Bit Shift Operation
48-Bit Shift Operators.
The three SPL 48-bit (triple-word) shift operators are described in Ta-
ble
5-17.