TAL Reference Manual
Statements
TAL Reference Manual—526371-001
12-8
Examples of Bit Deposit Assignments
Specify the variable/bit-field construct with no intervening spaces. For example:
myvar.<0:5>
Do not use bit deposit fields to pack data. Instead, declare an UNSIGNED variable and
specify the appropriate number of bits in the bit field.
Bit deposits are not portable to future software platforms. Where possible, isolate bit
deposits in a routine that can be modified in the future.
Examples of Bit Deposit Assignments
1. In this example, the bit deposit assignment sets bits 3 through 7 of the word
designated by X:
INT x;
x.<3:7> := %B11111;
2. This example replaces bits <10> and <11> with zeros:
INT old := -1; !OLD = %b1111111111111111
old.<10:11> := 0; !OLD = %b1111111111
001111
3. This example sets bit <8>, the leftmost bit of STRNG, to 0:
STRING strng := -1; !STRNG = %b11111111
strng.<8> := 0; !STRNG = %b
01111111
4. In this example, the value %577 is too large to fit in bits <7:12> of VAR. The
system truncates %577 to %77 before performing the bit deposit:
INT var := %125252; !VAR = %b1010101010101010
var.<7:12> := %577; !%77 = %b000000010
1111111
!VAR = %b1010101111111010
5. This example replaces bits <7:8> of NEW with bits <8:9> of OLD:
INT new := -1; !NEW = %b1111111111111111
INT old := 0; !OLD = %b00000000
00000000
new.<7:8> := old.<8:9>; !NEW = %b1111111
001111111