![]() |
![]() |
![]() |
![]() |
![]() |
Abstract Data Type for Byte
In this section an abstract data type for byte, i.e. unsigned char in C, is presented. This ADT can be used also in OS integrations and with Cmicro. However, please see the note below.
This ADT is only provided for backward compatibility, as the new predefined data type Octet should be used instead of Byte.
Purpose
The purpose of this data type is of course to have the type byte and the byte operations available directly in SDL.
The data type becomes available by including the file containing the definition with an analyzer included in an appropriate text symbol.
/*#include 'byte.pr' */Available Operators
The following operators are available in this data type:
BAND: byte, byte -> byte
Bitwise and. Corresponds to C operator &
BOR: byte, byte -> byte
Bitwise or. Corresponds to C operator |
BXOR: byte, byte -> byte
Bitwise exclusive or. Corresponds to C operator ^
BNOT: byte -> byte
Unary not. Corresponds to C operator ~
BSHL: byte, integer -> byte
Left shift of the byte parameter the number of steps specified by the integer parameter. Corresponds to C operator <<
(byte)( (b << i) & 0xFF )BSHR: byte, integer -> byte
Right shift of the byte parameter the number of steps specified by the integer parameter. Corresponds to C operator >>
Implementation: ( b >> i)BPLUS: byte, byte -> byte
Byte plus (modulus 0xFF). Corresponds to C operator +
BSUB: byte, byte -> byte
Byte minus (modulus 0xFF). Corresponds to C operator -
BMUL: byte, byte -> byte
Byte multiplication (modulus 0xFF). Corresponds to C operator *
BDIV: byte, byte -> byte
Byte division. Corresponds to C operator /
BMOD: byte, byte -> byte
Byte modulus. Corresponds to C operator %
BHEX: charstring -> byte
This operator transforms a charstring ('00' - 'ff' or 'FF') into a byte. The string may be prefixed with an optional '0x'.
I2B: integer -> byte
I2B transforms an integer in range 0 - 255 into a byte.
B2I: byte -> integer
http://www.ibm.com/rational |
![]() |
![]() |
![]() |
![]() |