TAL Programmer's Guide
TAL and C Guidelines
Mixed-Language Programming
17–28 096254 Tandem Computers Incorporated
Bit-Field Manipulation
You can manipulate bit fields in both TAL and C.
In TAL, you can use either:
Built-in bit-extraction and bit-deposit operations
Bit-wise operators LAND and LOR
In C, you can use either:
Bit-wise operators & (and) and | (or)
Defines
The following TAL bit-deposit operation and C bit-wise operation are equivalent:
TAL Code C Code
INT x := -1; short a = -1;
INT y := 0; short b = 0;
short temp = 0;
PROC example;
BEGIN void example ()
y.<0:2> := x.<10:12>; {
END; /* you can combine these */
/* with wider margins */
temp = a & 070;
temp = temp << 10;
b = (b & 017777)|temp;
}
Bit extractions and bit deposits are not portable to future software platforms.