Annotation of OpenXM/src/asir-doc/parts/builtin/bit.texi, Revision 1.2
1.2 ! noro 1: @comment $OpenXM$
! 2: \BJP
1.1 noro 3: @node bit $B1i;;(B,,, $BAH$_9~$_H!?t(B
4: @section bit $B1i;;(B
1.2 ! noro 5: \E
! 6: \BEG
! 7: @node Bit operations,,, Built-in Function
! 8: @section Bit operations
! 9: \E
1.1 noro 10:
11: @menu
12: * iand ior ixor::
13: * ishift::
14: @end menu
15:
1.2 ! noro 16: \JP @node iand ior ixor,,, bit $B1i;;(B
! 17: \EG @node iand ior ixor,,, Bit operations
1.1 noro 18: @subsection @code{iand}, @code{ior}, @code{ixor}
19: @findex iand
20: @findex ior
21: @findex ixor
22:
23: @table @t
24: @item iand(@var{i1},@var{i2})
1.2 ! noro 25: \JP :: bit $B$4$H$N(B and
! 26: \EG :: bitwise and
1.1 noro 27: @item ior(@var{i1},@var{i2})
1.2 ! noro 28: \JP :: bit $B$4$H$N(B or
! 29: \EG :: bitwise or
1.1 noro 30: @item ixor(@var{i1},@var{i2})
1.2 ! noro 31: \JP :: bit $B$4$H$N(B xor
! 32: \EG :: bitwise xor
1.1 noro 33: @end table
34:
35: @table @var
36: @item return
1.2 ! noro 37: \JP $B@0?t(B
! 38: \EG integer
1.1 noro 39: @item i1,i2
1.2 ! noro 40: \JP $B@0?t(B
! 41: \EG integer
1.1 noro 42: @end table
43:
44: @itemize @bullet
1.2 ! noro 45: \BJP
1.1 noro 46: @item
47: $B@0?t(B @var{i1}, @var{i2} $B$N@dBPCM$r(B bit $BNs$H$_$F1i;;$9$k(B.
48: @item
49: $B0z?t$NId9f$OL5;k$7(B, $BHsIi$NCM$rJV$9(B.
1.2 ! noro 50: \E
! 51: \BEG
! 52: @item
! 53: The absolute value of the argument is regarded as a bit string.
! 54: @item
! 55: The sign of the argument is ignored and a non-negative integer is returned.
! 56: \E
1.1 noro 57: @end itemize
58:
59: @example
60: [0] ctrl("hex",1);
61: 0x1
62: [1] iand(0xeeeeeeeeeeeeeeee,0x2984723234812312312);
63: 0x4622224802202202
64: [2] ior(0xa0a0a0a0a0a0a0a0,0xb0c0b0b0b0b0b0b);
65: 0xabacabababababab
66: [3] ixor(0xfffffffffff,0x234234234234);
67: 0x2cbdcbdcbdcb
68: @end example
69:
70: @table @t
1.2 ! noro 71: \JP @item $B;2>H(B
! 72: \EG @item References
1.1 noro 73: @fref{ishift}.
74: @end table
75:
1.2 ! noro 76: \JP @node ishift,,, bit $B1i;;(B
! 77: \EG @node ishift,,, Bit operations
1.1 noro 78: @subsection @code{ishift}
79: @findex ishift
80:
81: @table @t
82: @item ishift(@var{i},@var{count})
83: :: bit shift
84: @end table
85:
86: @table @var
87: @item return
1.2 ! noro 88: \JP $B@0?t(B
! 89: \EG integer
1.1 noro 90: @item i,count
1.2 ! noro 91: \JP $B@0?t(B
! 92: \EG integer
1.1 noro 93: @end table
94:
95: @itemize @bullet
1.2 ! noro 96: \BJP
1.1 noro 97: @item
98: $B@0?t(B @var{i} $B$N@dBPCM$r(B bit $BNs$H$_$F(B shift $B$9$k(B.
99: @item
100: @var{i} $B$NId9f$OL5;k$7(B, $BHsIi$NCM$rJV$9(B.
101: @item
102: @var{count} $B$,@5$J$i$P1&(B shift, $BIi$J$i$P:8(B shift $B$r9T$&(B.
1.2 ! noro 103: \E
! 104: \BEG
! 105: @item
! 106: The absolute value of @var{i} is regarded as a bit string.
! 107: @item
! 108: The sign of @var{i} is ignored and a non-negative integer is returned.
! 109: @item
! 110: If @var{count} is positive, then @var{i} is shifted to the right.
! 111: If @var{count} is negative, then @var{i} is shifted to the left.
! 112: \E
1.1 noro 113: @end itemize
114:
115: @example
116: [0] ctrl("hex",1);
117: 0x1
118: [1] ishift(0x1000000,12);
119: 0x1000
120: [2] ishift(0x1000,-12);
121: 0x1000000
122: [3] ixor(0x1248,ishift(1,-16)-1);
123: @end example
124:
125: @table @t
1.2 ! noro 126: \JP @item $B;2>H(B
! 127: \EG @item References
1.1 noro 128: @fref{iand ior ixor}.
129: @end table
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>