HP C/XL Bit Shift Macros and Functions [ SPL to HP C/XL Migration Guide ] MPE/iX 5.0 Documentation
SPL to HP C/XL Migration Guide
HP C/XL Bit Shift Macros and Functions
/************************************************************/
#define LSL(x,c) ((unsigned short) ((unsigned short) x << c))
/************************************************************/
#define LSR(x,c) ((unsigned short) ((unsigned short) x >> c))
/************************************************************/
#define ASL(x,c) ((short) ( ((short)x & 0x8000) | \
((short)x << c) & 0x7FFF) )
/************************************************************/
#define ASR(x,c) ((short) ((short)x >> c))
/************************************************************/
unsigned short CSL(x,c)
unsigned short x;
int c;
{
for (;;--c) {
if (c == 0) return(x);
x = ((x & 0x8000) >> 15) | x << 1;
}
}
/************************************************************/
unsigned short CSR(x,c)
unsigned short x;
int c;
{
for (;;--c) {
if (c == 0) return(x);
x = ((x & 0x0001) << 15) | x >> 1;
}
}
/************************************************************/
/************************************************************/
#define DLSL(x,c) ((unsigned int) ((unsigned int) x << c))
/************************************************************/
#define DLSR(x,c) ((unsigned int) ((unsigned int) x >> c))
/************************************************************/
#define DASL(x,c) ((int) ( ((int)x & 0x80000000) | \
((int)x << c) & 0x7FFFFFFF) )
/************************************************************/
#define DASR(x,c) ((int) ((int)x >> c))
/************************************************************/
unsigned int DCSL(x,c)
unsigned int x;
int c;
{
for (;;--c) {
if (c == 0) return(x);
x = ((x & 0x80000000) >> 31) | x << 1;
}
}
/************************************************************/
unsigned int DCSR(x,c)
unsigned int x;
int c;
{
for (;;--c) {
if (c == 0) return(x);
x = ((x & 0x00000001) << 31) | x >> 1;
}
}
/************************************************************/
MPE/iX 5.0 Documentation