Note also that if you shift left, bits in the upper part of the value are shifted `out` and lost, and if you shift right, lower bits are shifted out and lost. It's not the same as `rotating` the bits. If you shift left, it adds extra 0's at the lower end, and if you shift right it adds 0's at the upper end.
Shifts are borrowed from assembly language where you have commands like:
SHL (shift left)
SHR (shift right)
ROL (rotate left)
ROR (rotate right)
ASL (arithmetic shift left)
ASR (arithmetic shift right - maintains the sign of the number in the upper bit)
Vaguely, Shl and Shr are remnants of BlitzBasic's in-line assembler days. I wish the others were still available, too.
I think there are some common instructions among assembly languages on different CPU's, such that BRL could put together a small subset of cross-platform assembler instructions, like those above. Then we could at least do in-line assembly on *some* instructions.
Shifts are borrowed from assembly language where you have commands like:
SHL (shift left)
SHR (shift right)
ROL (rotate left)
ROR (rotate right)
ASL (arithmetic shift left)
ASR (arithmetic shift right - maintains the sign of the number in the upper bit)
Vaguely, Shl and Shr are remnants of BlitzBasic's in-line assembler days. I wish the others were still available, too.
I think there are some common instructions among assembly languages on different CPU's, such that BRL could put together a small subset of cross-platform assembler instructions, like those above. Then we could at least do in-line assembly on *some* instructions.