Knowledge (XXG)

Bitwise operation

Source 📝

1693: 682: 1688:{\displaystyle {\begin{aligned}\operatorname {NOT} x&=\sum _{n=0}^{\lfloor \log _{2}(x)\rfloor }2^{n}\left=2^{\left\lfloor \log _{2}(x)\right\rfloor +1}-1-x\\x\operatorname {AND} y&=\sum _{n=0}^{\lfloor \log _{2}(x)\rfloor }2^{n}\left(\left\lfloor {\frac {x}{2^{n}}}\right\rfloor {\bmod {2}}\right)\left(\left\lfloor {\frac {y}{2^{n}}}\right\rfloor {\bmod {2}}\right)\\x\operatorname {OR} y&=\sum _{n=0}^{\lfloor \log _{2}(x)\rfloor }2^{n}\left(\left(\left\lfloor {\frac {x}{2^{n}}}\right\rfloor {\bmod {2}}\right)+\left(\left\lfloor {\frac {y}{2^{n}}}\right\rfloor {\bmod {2}}\right)-\left(\left\lfloor {\frac {x}{2^{n}}}\right\rfloor {\bmod {2}}\right)\left(\left\lfloor {\frac {y}{2^{n}}}\right\rfloor {\bmod {2}}\right)\right)\\x\operatorname {XOR} y&=\sum _{n=0}^{\lfloor \log _{2}(x)\rfloor }2^{n}\left(\left{\bmod {2}}\right)=\sum _{n=0}^{\lfloor \log _{2}(x)\rfloor }2^{n}\left\end{aligned}}} 465: 2257: 2478: 2468: 2364: 2354: 2249: 25: 2436: 2594:, so care must be taken when using them. The result of shifting by a bit count greater than or equal to the word's size is undefined behavior in C and C++. Right-shifting a negative value is implementation-defined and not recommended by good coding practice; the result of left-shifting a signed value is undefined if the result cannot be represented in the result type. 2426: 260: 392: 2451:, the bits are "rotated" as if the left and right ends of the register were joined. The value that is shifted into the right during a left-shift is whatever value was shifted out on the left, and vice versa for a right-shift operation. This is useful if it is necessary to retain all the existing bits, and is frequently used in digital 2527:, because if a large number is stored in two registers, the bit that is shifted off one end of the first register must come in at the other end of the second. With rotate-through-carry, that bit is "saved" in the carry flag during the first shift, ready to shift in during the second shift without any extra preparation. 503:
The bitwise XOR may be used to invert selected bits in a register (also called toggle or flip). Any bit may be toggled by XORing it with 1. For example, given the bit pattern 0010 (decimal 2) the second and fourth bits may be toggled by a bitwise XOR with a bit pattern containing 1 in the second and
2822:
where the shift amount is tested to ensure that it does not introduce undefined behavior. However, the branch adds an additional code path and presents an opportunity for timing analysis and attack, which is often not acceptable in high-integrity software. In addition, the code compiles to multiple
2180:
If the width of the register (frequently 32 or even 64) is larger than the number of bits (usually 8) of the smallest addressable unit, frequently called byte, the shift operations induce an addressing scheme from the bytes to the bits. Thereby the orientations "left" and "right" are taken from the
163:
On simple low-cost processors, typically, bitwise operations are substantially faster than division, several times faster than multiplication, and sometimes significantly faster than addition. While modern processors usually perform addition and multiplication just as fast as bitwise operations due
3025:
If the promoted type of the left-hand operand is int, only the five lowest-order bits of the right-hand operand are used as the shift distance. It is as if the right-hand operand were subjected to a bitwise logical AND operator & with the mask value 0x1f (0b11111). The shift distance actually
354:
For example, 0110 (decimal 6) can be considered a set of four flags numbered from right to left, where the first and fourth flags are clear (0), and the second and third flags are set (1). The third flag may be cleared by using a bitwise AND with the pattern that has a zero only in the third bit:
3029:
If the promoted type of the left-hand operand is long, then only the six lowest-order bits of the right-hand operand are used as the shift distance. It is as if the right-hand operand were subjected to a bitwise logical AND operator & with the mask value 0x3f (0b111111). The shift distance
3633:
It can be hard to solve for variables in Boolean algebra, because unlike regular algebra, several operations do not have inverses. Operations without inverses lose some of the original data bits when they are performed, and it is not possible to recover this missing information.
2171:
in a computer processor have a fixed width, so some bits will be "shifted out" of the register at one end, while the same number of bits are "shifted in" from the other end; the differences between bit shift operators lie in how they determine the values of the shifted-in bits.
484:
operation on each pair of corresponding bits. The result in each position is 1 if only one of the bits is 1, but will be 0 if both are 0 or both are 1. In this we perform the comparison of two bits, being 1 if the two bits are different, and 0 if they are the same. For example:
251:, which can be visualized on a graph as a downward line that effectively "flips" an increasing range from 0 to 255, to a decreasing range from 255 to 0. A simple but illustrative example use is to invert a grayscale image where each pixel is stored as an unsigned integer. 283:
operation on each pair of the corresponding bits. Thus, if both bits in the compared position are 1, the bit in the resulting binary representation is 1 (1 × 1 = 1); otherwise, the result is 0 (1 × 0 = 0 and 0 × 0 = 0). For example:
180:
In the explanations below, any indication of a bit's position is counted from the right (least significant) side, advancing left. For example, the binary value 0001 (decimal 1) has zeroes at every position but the first (i.e., the rightmost) one.
2189:
orientation. Disregarding the boundary effects at both ends of the register, arithmetic and logical shift operations behave the same, and a shift by 8 bit positions transports the bit pattern by 1 byte position in the following way:
3209:
Although machines often have efficient built-in instructions for performing arithmetic and logical operations, all these operations can be performed by combining the bitwise operators and zero-testing in various ways. For example, here is a
429:
The bitwise OR may be used to set to 1 the selected bits of the register described above. For example, the fourth bit of 0010 (decimal 2) may be set by performing a bitwise OR with the pattern with only the fourth bit set:
2492:
is a variant of the rotate operation, where the bit that is shifted in (on either end) is the old value of the carry flag, and the bit that is shifted out (on the other end) becomes the new value of the carry flag.
2382:
However, as the logical right-shift inserts value 0 bits into the most significant bit, instead of copying the sign bit, it is ideal for unsigned binary numbers, while the arithmetic right-shift is ideal for signed
547:
to zero. Performing XOR on a value against itself always yields zero, and on many architectures this operation requires fewer clock cycles and less memory than loading a zero value and saving it to the register.
2292:
In the first case, the leftmost digit was shifted past the end of the register, and a new 0 was shifted into the rightmost position. In the second case, the rightmost 1 was shifted out (perhaps into the
687: 2297:), and a new 1 was copied into the leftmost position, preserving the sign of the number. Multiple shifts are sometimes shortened to a single shift by some number of digits. For example: 247:, the bitwise complement of a number is the "mirror reflection" of the number across the half-way point of the unsigned integer's range. For example, for 8-bit unsigned integers, 600: 310:(0). For example, given a bit pattern 0011 (decimal 3), to determine whether the second bit is set we use a bitwise AND with a bit pattern containing 1 only in the second bit: 2163:
are sometimes considered bitwise operations, because they treat a value as a series of bits rather than as a numerical quantity. In these operations, the digits are moved, or
3206:
Bitwise operations are necessary particularly in lower-level programming such as device drivers, low-level graphics, communications protocol packet assembly, and decoding.
635: 2597:
In C#, the right-shift is an arithmetic shift when the first operand is an int or long. If the first operand is of type uint or ulong, the right-shift is a logical shift.
672: 3435:
Sometimes it is useful to simplify complex expressions made up of bitwise operations, for example when writing compilers. The goal of a compiler is to translate a
2936:. Clang provides some rotate intrinsics for Microsoft compatibility that suffers the problems above. GCC does not offer rotate intrinsics. Intel also provides x86 3150:
behaves like a logical shift, and does not copy the sign bit. The number of places to shift is given as the second argument. For example, the following assigns
4067:
Throughout this article, 0xFFFF means that all the bits in your data type need to be set to 1. The exact number of bits depends on the width of the data type.
2268:, the bits that are shifted out of either end are discarded. In a left arithmetic shift, zeros are shifted in on the right; in a right arithmetic shift, the 2500:
can simulate a logical or arithmetic shift of one position by setting up the carry flag beforehand. For example, if the carry flag contains 0, then
3862: 411:
operation on each pair of corresponding bits. The result in each position is 0 if both bits are 0, while otherwise the result is 1. For example:
340:, portions that should not be altered or portions that are not of interest. In this case, the 0 values mask the bits that are not of interest.) 2964:" to perform logical right shifts, but since the logical and arithmetic left-shift operations are identical for signed integer, there is no " 2185:, such that a left shift increases and a right shift decreases the value of the number ― if the left digits are read first, this makes up a 4116: 42: 2834:, the following is recommended. The pattern is recognized by many compilers, and the compiler will emit a single rotate instruction: 108: 4148: 89: 3436: 3215: 2379:, zeros are shifted in to replace the discarded bits. Therefore, the logical and arithmetic left-shifts are exactly the same. 61: 4120: 46: 3978:"Constant not propagated into inline assembly, results in "constraint 'I' expects an integer constant expression"" 2613:), but one can be synthesized from the shift operators. Care must be taken to ensure the statement is well formed to avoid 2937: 160:. Most bitwise operations are presented as two-operand instructions where the result replaces one of the input operands. 68: 3838: 556: 3060:. If the byte value is negative, the highest bit is one, then ones are used to fill up the extra bytes in the int. So 2949: 2621:
in software with security requirements. For example, a naive implementation that left-rotates a 32-bit unsigned value
2324: 4143: 244: 75: 328:
Because the result 0010 is non-zero, we know the second bit in the original pattern was set. This is often called
35: 156:. It is a fast and simple action, basic to the higher-level arithmetic operations and directly supported by the 4153: 3679: 2554:" for right shift. The number of places to shift is given as the second argument to the operator. For example, 2523:
Rotate through carry is especially useful when performing shifts on numbers larger than the processor's native
57: 351:. This technique is an efficient way to store a number of Boolean values using as little memory as possible. 4127: 3751: 2827: 1758: 1746: 157: 4013: 3337:
Another example is a pseudocode implementation of addition, showing how to calculate a sum of two integers
3998: 3736: 1787: 481: 169: 122: 569: 172:
design choices, bitwise operations do commonly use less power because of the reduced use of resources.
3887: 3684:
Operations at the top of this list are executed first. See the main article for a more complete list.
2182: 1807: 1797: 374: 165: 133: 3781: 3195: 2509: 2384: 2328: 2320: 2312: 1812: 1802: 1792: 1782: 609: 603: 408: 233: 212: 190: 2272:(the MSB in two's complement) is shifted in on the left, thus preserving the sign of the operand. 2917: 2614: 2591: 2168: 544: 215:
of the given binary value. Bits that are 0 become 1, and those that are 1 become 0. For example:
2929: 2925: 464: 82: 2256: 1817: 536: 348: 2994:
The type of the shift expression is the promoted type of the left-hand operand. For example,
2823:
machine instructions, which is often less efficient than the processor's native instruction.
651: 3776: 3741: 2477: 2243: 477: 404: 377:
of a binary number by checking the value of the lowest valued bit. Using the example above:
276: 208: 2467: 533:
This technique may be used to manipulate bit patterns representing sets of Boolean states.
3430: 1708: 264: 204: 3953: 3825: 3761: 2921: 2536: 2396: 2363: 1704: 149: 2504:
is a logical right-shift, and if the carry flag contains a copy of the sign bit, then
2353: 2248: 4137: 3932: 3756: 3131: 2618: 2508:
is an arithmetic right-shift. For this reason, some microcontrollers such as low end
2344: 2198: 1736: 126: 3766: 3440: 2933: 2452: 1775: 676:, for the non-negative integers, the bitwise operations can be written as follows: 564: 333: 4110: 4098: 3119: 1741: 1712: 280: 24: 4030: 3977: 3771: 3561:
Additionally, XOR can be composed using the 3 basic operations (AND, OR, NOT)
3211: 3135: 3115: 2294: 2216: 2186: 141: 4047: 3802: 2524: 344: 145: 3443:
possible. Boolean algebra is used to simplify complex bitwise expressions.
2605:
The C-family of languages lack a rotate operator (although C++20 provides
2587:
to the left by two bits, which is equivalent to a multiplication by four.
2435: 3746: 3189: 2332: 2269: 1763: 1751: 540: 2425: 3911: 259: 2275:
This example uses an 8-bit register, interpreted as two's complement:
391: 236:
of the value minus one. If two's complement arithmetic is used, then
279:
that takes two equal-length binary representations and performs the
4104: 2331:, then the same right-shift operation results in division by 2 and 383:
Because 6 AND 1 is zero, 6 is divisible by two and therefore even.
302:
The operation may be used to determine whether a particular bit is
3030:
actually used is therefore always in the range 0 to 63, inclusive.
2831: 2728:
is outside the range 0–31 inclusive. A second try might result in
2520:, and don't bother with arithmetic or logical shift instructions. 606: 463: 390: 258: 3912:"Near constant time rotate that does not violate the standards?" 2712:
bits results in undefined behavior in the right-hand expression
2960:" operators perform arithmetic shifts. Java adds the operator " 2311:
is equivalent to multiplying by 2 (provided the value does not
1718:
Here is the bitwise equivalent operations of two bits P and Q:
4048:"Synthesizing arithmetic operations using bit-shifting tricks" 2229:
a right shift by 8 positions increases the byte address by 1.
2211:
a right shift by 8 positions decreases the byte address by 1.
1770: 153: 18: 2222:
a left shift by 8 positions decreases the byte address by 1,
2204:
a left shift by 8 positions increases the byte address by 1,
1667: 1525: 1505: 1457: 1318: 1273: 1225: 1177: 1048: 1003: 819: 798: 480:
that takes two bit patterns of equal length and performs the
407:
that takes two bit patterns of equal length and performs the
3869:. Software Engineering Institute, Carnegie Mellon University 152:(considered as a bit string) at the level of its individual 2462: 2420: 2348: 543:
sometimes use XOR as a short-cut to setting the value of a
380:
0110 (decimal 6) AND 0001 (decimal 1) = 0000 (decimal 0)
347:) of a register in which each bit represents an individual 3863:"INT13-C. Use bitwise operators only on unsigned operands" 121:"Binary shift" redirects here. For the excess-3 code, see 3026:
used is therefore always in the range 0 to 31, inclusive.
2546:
In C and C++ languages, the logical shift operators are "
4130:" by Enrique Zeleny, The Wolfram Demonstrations Project. 3118:
uses bitwise operations to evaluate each of two or more
2590:
Shifts can result in implementation-defined behavior or
3954:"Circular rotate that does not violate C/C++ standard?" 638:, then vector addition corresponds to the bitwise XOR. 373:
Because of this property, it becomes easy to check the
343:
The bitwise AND may be used to clear selected bits (or
229:
NOT 10101011 (decimal 171) = 01010100 (decimal 84)
2327:
of division by 2. If the binary number is treated as
685: 654: 612: 572: 3138:), the logical left and right shift operators are " 3130:In Pascal, as well as in all its dialects (such as 3103: 3061: 3034: 2999: 2826:To avoid the undefined behavior and branches under 49:. Unsourced material may be challenged and removed. 2537:Circular shift § Implementing circular shifts 2300:00010111 (decimal +23) LEFT-SHIFT-BY-TWO = 010111 1687: 666: 629: 594: 3680:Operators in C and C++ § Operator precedence 3906: 3904: 3218:showing how to multiply two arbitrary integers 4008: 4006: 8: 3933:"Poor optimization of portable rotate idiom" 3826:JTC1/SC22/WG14 N843 "C programming language" 2278:00010111 (decimal +23) LEFT-SHIFT = 0010111 1699:Truth table for all binary logical operators 1583: 1558: 1401: 1376: 1126: 1101: 957: 932: 747: 722: 4128:Plots Of Compositions Of Bitwise Operations 3613:x & (y ^ z) = (x & y) ^ (x & z) 3608:x & (y | z) = (x & y) | (x & z) 3146:", respectively. Even for signed integers, 3618:x + y = (x ^ y) + ((x & y) << 1) 3345:using bitwise operators and zero-testing: 551:If the set of bit strings of fixed length 3997:The Java Language Specification, section 3839:"Arithmetic operators - cppreference.com" 3458:x & (y & z) = (x & y) & z 1670: 1666: 1649: 1640: 1621: 1612: 1592: 1565: 1557: 1546: 1528: 1524: 1508: 1504: 1492: 1483: 1460: 1456: 1444: 1435: 1410: 1383: 1375: 1364: 1321: 1317: 1305: 1296: 1276: 1272: 1260: 1251: 1228: 1224: 1212: 1203: 1180: 1176: 1164: 1155: 1135: 1108: 1100: 1089: 1051: 1047: 1035: 1026: 1006: 1002: 990: 981: 966: 939: 931: 920: 850: 840: 822: 818: 801: 797: 785: 776: 756: 729: 721: 710: 686: 684: 653: 621: 615: 614: 611: 586: 581: 575: 574: 571: 109:Learn how and when to remove this message 2952:, all integer types are signed, so the " 2476: 2466: 2434: 2424: 2362: 2352: 2255: 2247: 1720: 3794: 3603:x | (y & z) = (x | y) & (x | z) 2285:10010111 (decimal −105) RIGHT-SHIFT = 4107:, a tool for bitwise-XOR files/streams 3972: 3970: 3048:In bit and shift operations, the type 2987:(unsigned right shift) are called the 2971:More details of Java shift operators: 3234:) using only bitshifts and addition: 2315:), while a right arithmetic shift by 7: 3821: 3819: 2447:In this operation, sometimes called 47:adding citations to reliable sources 4085:- is subtraction here, not negation 4076:- is negation here, not subtraction 3571:a ^ b = (a & ~b) | (~a & b) 2506:x RIGHT-ROTATE-THROUGH-CARRY-BY-ONE 2502:x RIGHT-ROTATE-THROUGH-CARRY-BY-ONE 3045:bit positions with zero-extension. 2323:value is equivalent to taking the 14: 3803:"CMicrotek Low-power Design Blog" 2916:There are also compiler-specific 2181:standard writing of numbers in a 595:{\displaystyle {\bf {F}}_{2}^{n}} 4101:supports Bitwise AND, OR and XOR 616: 576: 23: 3566:a ^ b = (a | b) & (~a | ~b) 3437:high-level programming language 3216:ancient Egyptian multiplication 125:. For the general concept, see 34:needs additional citations for 4121:Wolfram Demonstrations Project 3629:Inverses and solving equations 2439:Right circular shift or rotate 1580: 1574: 1398: 1392: 1123: 1117: 954: 948: 865: 859: 744: 738: 1: 3867:CERT: Secure Coding Standards 2429:Left circular shift or rotate 2401:Another form of shift is the 630:{\displaystyle {\bf {F}}_{2}} 468:Bitwise XOR of 4-bit integers 4050:. Bisqwit.iki.fi. 2014-02-15 395:Bitwise OR of 4-bit integers 3054:is implicitly converted to 2307:A left arithmetic shift by 539:programmers and optimizing 232:The result is equal to the 4170: 3677: 3428: 2983:(signed right shift), and 2534: 2481:Right rotate through carry 2394: 2342: 2241: 332:. (By analogy, the use of 188: 120: 4099:Online Bitwise Calculator 4014:"Chapter 15. Expressions" 3888:"Operator (C# Reference)" 3536:x ^ (y ^ z) = (x ^ y) ^ z 3492:x | (y | z) = (x | y) | z 3158:to the left by two bits: 2471:Left rotate through carry 2047: 1779: 1733: 211:on each bit, forming the 4117:Bitwise Operations Mod N 4111:Division using bitshifts 3956:. Intel Developer Forums 3914:. Stack Exchange Network 3439:into the most efficient 3347: 3236: 3160: 2836: 2730: 2631: 2556: 2542:In C family of languages 2167:, to the left or right. 642:Mathematical equivalents 4149:Operators (programming) 3752:Bitwise operations in C 3154:the result of shifting 2583:the result of shifting 2531:In high-level languages 667:{\displaystyle x\geq y} 3999:15.19. Shift Operators 3598:~(x & y) = ~x | ~y 3593:~(x | y) = ~x & ~y 3192:, used in cryptography 2550:" for left shift and " 2482: 2472: 2440: 2430: 2368: 2358: 2289:1001011 (decimal −53) 2261: 2260:Right arithmetic shift 2253: 1703:There are 16 possible 1689: 1587: 1405: 1130: 961: 751: 668: 631: 596: 559:) is thought of as an 469: 396: 268: 16:Computer science topic 4119:" by Enrique Zeleny, 3737:Arithmetic logic unit 3453:x & y = y & x 2714:(x >> (32 - n)) 2535:Further information: 2480: 2470: 2438: 2428: 2395:Further information: 2366: 2356: 2259: 2252:Left arithmetic shift 2251: 1690: 1542: 1360: 1085: 916: 706: 669: 632: 597: 467: 394: 366:11 (decimal 11) = 0 262: 222:111 (decimal 7) = 166:instruction pipelines 123:Shifted binary (code) 4031:"JavaScript Bitwise" 2996:aByte >>> 2 2968:" operator in Java. 2708:However, a shift by 2629:positions is simply 2518:rotate through carry 2498:rotate through carry 2490:Rotate through carry 2459:Rotate through carry 2333:rounding toward zero 2183:place-value notation 683: 652: 610: 570: 482:logical exclusive OR 409:logical inclusive OR 362:10 (decimal 6) AND 1 321:0 (decimal 2) = 00 317:1 (decimal 3) AND 00 134:computer programming 43:improve this article 3843:en.cppreference.com 3782:Primitive data type 3674:Order of operations 3588:x & (x | y) = x 3583:x | (x & y) = x 3502:x | 0xFFFF = 0xFFFF 3196:count leading zeros 2367:Right logical shift 591: 522:0 (decimal 10) = 496:1 (decimal 3) = 0 492:1 (decimal 5) XOR 0 295:(decimal 3) = 000 291:(decimal 5) AND 001 58:"Bitwise operation" 3463:x & 0xFFFF = x 3214:implementation of 2615:undefined behavior 2592:undefined behavior 2483: 2473: 2441: 2431: 2369: 2359: 2357:Left logical shift 2262: 2254: 1685: 1683: 664: 627: 592: 573: 514:0 (decimal 2) XOR 504:fourth positions: 470: 397: 269: 201:bitwise complement 4144:Binary arithmetic 3935:. GNU GCC Project 3709:<< >> 3623:x - y = ~(~x + y) 2998:is equivalent to 2487: 2486: 2445: 2444: 2373: 2372: 2233: 2232: 2152: 2151: 2148: 2143: 2138: 2131: 2126: 2119: 2114: 2107: 2102: 2095: 2090: 2083: 2076: 2069: 2062: 2055: 1711:; this defines a 1655: 1627: 1498: 1450: 1311: 1266: 1218: 1170: 1041: 996: 791: 537:Assembly language 448:0 (decimal 8) = 440:0 (decimal 2) OR 226:000 (decimal 8) 176:Bitwise operators 138:bitwise operation 119: 118: 111: 93: 4161: 4086: 4083: 4077: 4074: 4068: 4065: 4059: 4058: 4056: 4055: 4044: 4038: 4028: 4022: 4021: 4010: 4001: 3995: 3989: 3988: 3986: 3985: 3974: 3965: 3964: 3962: 3961: 3950: 3944: 3943: 3941: 3940: 3929: 3923: 3922: 3920: 3919: 3908: 3899: 3898: 3896: 3895: 3884: 3878: 3877: 3875: 3874: 3859: 3853: 3852: 3850: 3849: 3835: 3829: 3823: 3814: 3813: 3811: 3810: 3799: 3777:Logical operator 3742:Bit manipulation 3725: 3720: 3715: 3710: 3705: 3700: 3695: 3690: 3624: 3619: 3614: 3609: 3604: 3599: 3594: 3589: 3584: 3572: 3567: 3557: 3552: 3547: 3542: 3537: 3532: 3520: 3508: 3503: 3498: 3493: 3488: 3476: 3469: 3464: 3459: 3454: 3420: 3417: 3414: 3411: 3408: 3405: 3402: 3399: 3396: 3393: 3390: 3387: 3384: 3381: 3378: 3375: 3372: 3369: 3366: 3363: 3360: 3357: 3354: 3351: 3344: 3340: 3333: 3330: 3327: 3324: 3321: 3318: 3315: 3312: 3309: 3306: 3303: 3300: 3297: 3294: 3291: 3288: 3285: 3282: 3279: 3276: 3273: 3270: 3267: 3264: 3261: 3258: 3255: 3252: 3249: 3246: 3243: 3240: 3233: 3229: 3225: 3221: 3179: 3176: 3173: 3170: 3167: 3164: 3149: 3145: 3141: 3105: 3101: 3100: 3097: 3094: 3091: 3088: 3085: 3082: 3079: 3076: 3073: 3070: 3067: 3064: 3059: 3053: 3036: 3035:n >>> s 3021: 3020: 3017: 3014: 3011: 3008: 3005: 3002: 2997: 2986: 2982: 2978: 2967: 2963: 2959: 2955: 2912: 2909: 2906: 2903: 2900: 2897: 2894: 2891: 2888: 2885: 2882: 2879: 2876: 2873: 2870: 2867: 2864: 2861: 2858: 2855: 2852: 2849: 2846: 2843: 2840: 2818: 2815: 2812: 2809: 2806: 2803: 2800: 2797: 2794: 2791: 2788: 2785: 2782: 2779: 2776: 2773: 2770: 2767: 2764: 2761: 2758: 2755: 2752: 2749: 2746: 2743: 2740: 2737: 2734: 2727: 2723: 2719: 2715: 2711: 2704: 2701: 2698: 2695: 2692: 2689: 2686: 2683: 2680: 2677: 2674: 2671: 2668: 2665: 2662: 2659: 2656: 2653: 2650: 2647: 2644: 2641: 2638: 2635: 2628: 2624: 2612: 2608: 2586: 2582: 2575: 2572: 2569: 2566: 2563: 2560: 2553: 2549: 2507: 2503: 2463: 2421: 2407:bitwise rotation 2387:binary numbers. 2385:two's complement 2349: 2329:ones' complement 2321:two's complement 2266:arithmetic shift 2244:Arithmetic shift 2238:Arithmetic shift 2195: 2194: 2146: 2141: 2134: 2129: 2122: 2117: 2110: 2105: 2098: 2093: 2086: 2079: 2072: 2065: 2058: 2053: 1721: 1709:binary variables 1694: 1692: 1691: 1686: 1684: 1680: 1676: 1675: 1674: 1665: 1661: 1660: 1656: 1654: 1653: 1641: 1632: 1628: 1626: 1625: 1613: 1597: 1596: 1586: 1570: 1569: 1556: 1538: 1534: 1533: 1532: 1523: 1519: 1518: 1514: 1513: 1512: 1503: 1499: 1497: 1496: 1484: 1470: 1466: 1465: 1464: 1455: 1451: 1449: 1448: 1436: 1415: 1414: 1404: 1388: 1387: 1374: 1336: 1332: 1331: 1327: 1326: 1325: 1316: 1312: 1310: 1309: 1297: 1286: 1282: 1281: 1280: 1271: 1267: 1265: 1264: 1252: 1238: 1234: 1233: 1232: 1223: 1219: 1217: 1216: 1204: 1190: 1186: 1185: 1184: 1175: 1171: 1169: 1168: 1156: 1140: 1139: 1129: 1113: 1112: 1099: 1061: 1057: 1056: 1055: 1046: 1042: 1040: 1039: 1027: 1016: 1012: 1011: 1010: 1001: 997: 995: 994: 982: 971: 970: 960: 944: 943: 930: 880: 879: 872: 868: 855: 854: 832: 828: 827: 826: 817: 813: 806: 805: 796: 792: 790: 789: 777: 761: 760: 750: 734: 733: 720: 675: 673: 671: 670: 665: 636: 634: 633: 628: 626: 625: 620: 619: 601: 599: 598: 593: 590: 585: 580: 579: 478:binary operation 422:(decimal 3) = 0 418:(decimal 5) OR 0 405:binary operation 277:binary operation 250: 239: 234:two's complement 213:ones' complement 209:logical negation 191:Ones' complement 164:to their longer 114: 107: 103: 100: 94: 92: 51: 27: 19: 4169: 4168: 4164: 4163: 4162: 4160: 4159: 4158: 4154:Boolean algebra 4134: 4133: 4095: 4090: 4089: 4084: 4080: 4075: 4071: 4066: 4062: 4053: 4051: 4046: 4045: 4041: 4029: 4025: 4012: 4011: 4004: 3996: 3992: 3983: 3981: 3976: 3975: 3968: 3959: 3957: 3952: 3951: 3947: 3938: 3936: 3931: 3930: 3926: 3917: 3915: 3910: 3909: 3902: 3893: 3891: 3886: 3885: 3881: 3872: 3870: 3861: 3860: 3856: 3847: 3845: 3837: 3836: 3832: 3828:, section 6.5.7 3824: 3817: 3808: 3806: 3801: 3800: 3796: 3791: 3786: 3732: 3723: 3718: 3713: 3708: 3703: 3698: 3693: 3688: 3682: 3676: 3631: 3622: 3617: 3612: 3607: 3602: 3597: 3592: 3587: 3582: 3579: 3570: 3565: 3556:x ^ 0xFFFF = ~x 3555: 3550: 3545: 3540: 3535: 3530: 3527: 3518: 3515: 3506: 3501: 3496: 3491: 3486: 3483: 3474: 3467: 3462: 3457: 3452: 3449: 3433: 3431:Boolean algebra 3427: 3425:Boolean algebra 3422: 3421: 3418: 3415: 3412: 3409: 3406: 3403: 3400: 3397: 3394: 3391: 3388: 3385: 3382: 3379: 3376: 3373: 3370: 3367: 3364: 3361: 3358: 3355: 3352: 3349: 3342: 3338: 3335: 3334: 3331: 3328: 3325: 3322: 3319: 3316: 3313: 3310: 3307: 3304: 3301: 3298: 3295: 3292: 3289: 3286: 3283: 3280: 3277: 3274: 3271: 3268: 3265: 3262: 3259: 3256: 3253: 3250: 3247: 3244: 3241: 3238: 3231: 3227: 3223: 3219: 3204: 3186: 3181: 3180: 3177: 3174: 3171: 3168: 3165: 3162: 3147: 3143: 3139: 3136:Standard Pascal 3128: 3113: 3102:will result in 3098: 3095: 3092: 3089: 3086: 3083: 3080: 3077: 3074: 3071: 3068: 3065: 3062: 3055: 3049: 3018: 3015: 3012: 3009: 3006: 3003: 3000: 2995: 2989:shift operators 2984: 2980: 2976: 2965: 2961: 2957: 2953: 2946: 2930:_rotr8, _rotr16 2926:_rotl8, _rotl16 2922:circular shifts 2914: 2913: 2910: 2907: 2904: 2901: 2898: 2895: 2892: 2889: 2886: 2883: 2880: 2877: 2874: 2871: 2868: 2865: 2862: 2859: 2856: 2853: 2850: 2847: 2844: 2841: 2838: 2820: 2819: 2816: 2813: 2810: 2807: 2804: 2801: 2798: 2795: 2792: 2789: 2786: 2783: 2780: 2777: 2774: 2771: 2768: 2765: 2762: 2759: 2756: 2753: 2750: 2747: 2744: 2741: 2738: 2735: 2732: 2725: 2721: 2717: 2713: 2709: 2706: 2705: 2702: 2699: 2696: 2693: 2690: 2687: 2684: 2681: 2678: 2675: 2672: 2669: 2666: 2663: 2660: 2657: 2654: 2651: 2648: 2645: 2642: 2639: 2636: 2633: 2626: 2622: 2610: 2606: 2603: 2601:Circular shifts 2584: 2580: 2577: 2576: 2573: 2570: 2567: 2564: 2561: 2558: 2551: 2547: 2544: 2539: 2533: 2505: 2501: 2461: 2449:rotate no carry 2419: 2399: 2393: 2347: 2341: 2305: 2290: 2283: 2246: 2240: 2178: 2157: 2136: 2124: 2112: 2100: 2088: 2081: 2074: 2067: 2060: 2049: 1705:truth functions 1701: 1682: 1681: 1645: 1636: 1617: 1608: 1607: 1603: 1602: 1598: 1588: 1561: 1488: 1479: 1478: 1474: 1440: 1431: 1430: 1426: 1425: 1421: 1420: 1416: 1406: 1379: 1353: 1338: 1337: 1301: 1292: 1291: 1287: 1256: 1247: 1246: 1242: 1208: 1199: 1198: 1194: 1160: 1151: 1150: 1146: 1145: 1141: 1131: 1104: 1078: 1063: 1062: 1031: 1022: 1021: 1017: 986: 977: 976: 972: 962: 935: 909: 894: 893: 846: 845: 841: 836: 781: 772: 771: 767: 766: 762: 752: 725: 699: 681: 680: 650: 649: 647: 644: 613: 608: 607: 568: 567: 531: 501: 462: 457: 456:0 (decimal 10) 427: 389: 381: 371: 370:10 (decimal 2) 326: 300: 263:Bitwise AND of 257: 249:NOT x = 255 - x 248: 237: 230: 227: 205:unary operation 193: 187: 178: 130: 115: 104: 98: 95: 52: 50: 40: 28: 17: 12: 11: 5: 4167: 4165: 4157: 4156: 4151: 4146: 4136: 4135: 4132: 4131: 4124: 4113: 4108: 4102: 4094: 4093:External links 4091: 4088: 4087: 4078: 4069: 4060: 4039: 4023: 4002: 3990: 3980:. LLVM Project 3966: 3945: 3924: 3900: 3879: 3854: 3830: 3815: 3793: 3792: 3790: 3787: 3785: 3784: 3779: 3774: 3769: 3764: 3762:Find first set 3759: 3754: 3749: 3744: 3739: 3733: 3731: 3728: 3727: 3726: 3721: 3716: 3711: 3706: 3701: 3696: 3691: 3678:Main article: 3675: 3672: 3671: 3670: 3669: 3668: 3665: 3662: 3659: 3653: 3652: 3651: 3648: 3645: 3642: 3630: 3627: 3626: 3625: 3620: 3615: 3610: 3605: 3600: 3595: 3590: 3585: 3578: 3575: 3574: 3573: 3568: 3559: 3558: 3553: 3548: 3543: 3538: 3533: 3526: 3523: 3522: 3521: 3514: 3511: 3510: 3509: 3504: 3499: 3494: 3489: 3482: 3479: 3478: 3477: 3471: 3470: 3465: 3460: 3455: 3448: 3445: 3429:Main article: 3426: 3423: 3348: 3237: 3203: 3200: 3199: 3198: 3193: 3185: 3182: 3161: 3127: 3124: 3112: 3109: 3108: 3107: 3046: 3041:right-shifted 3031: 3027: 3023: 2992: 2979:(left shift), 2975:The operators 2945: 2942: 2837: 2731: 2632: 2619:timing attacks 2602: 2599: 2557: 2543: 2540: 2532: 2529: 2485: 2484: 2474: 2460: 2457: 2443: 2442: 2432: 2418: 2415: 2403:circular shift 2397:Circular shift 2392: 2391:Circular shift 2389: 2371: 2370: 2360: 2343:Main article: 2340: 2337: 2304:(decimal +92) 2299: 2284: 2282:(decimal +46) 2277: 2242:Main article: 2239: 2236: 2235: 2234: 2231: 2230: 2227: 2224: 2223: 2220: 2213: 2212: 2209: 2206: 2205: 2202: 2177: 2176:Bit addressing 2174: 2156: 2153: 2150: 2149: 2144: 2139: 2132: 2127: 2120: 2115: 2108: 2103: 2096: 2091: 2084: 2077: 2070: 2063: 2056: 2051: 2045: 2044: 2041: 2038: 2035: 2032: 2029: 2026: 2023: 2020: 2017: 2014: 2011: 2008: 2005: 2002: 1999: 1996: 1993: 1989: 1988: 1985: 1982: 1979: 1976: 1973: 1970: 1967: 1964: 1961: 1958: 1955: 1952: 1949: 1946: 1943: 1940: 1937: 1933: 1932: 1929: 1926: 1923: 1920: 1917: 1914: 1911: 1908: 1905: 1902: 1899: 1896: 1893: 1890: 1887: 1884: 1881: 1877: 1876: 1873: 1870: 1867: 1864: 1861: 1858: 1855: 1852: 1849: 1846: 1843: 1840: 1837: 1834: 1831: 1828: 1825: 1821: 1820: 1815: 1810: 1805: 1800: 1795: 1790: 1785: 1780: 1778: 1773: 1768: 1761: 1756: 1749: 1744: 1739: 1734: 1732: 1727: 1700: 1697: 1696: 1695: 1679: 1673: 1669: 1664: 1659: 1652: 1648: 1644: 1639: 1635: 1631: 1624: 1620: 1616: 1611: 1606: 1601: 1595: 1591: 1585: 1582: 1579: 1576: 1573: 1568: 1564: 1560: 1555: 1552: 1549: 1545: 1541: 1537: 1531: 1527: 1522: 1517: 1511: 1507: 1502: 1495: 1491: 1487: 1482: 1477: 1473: 1469: 1463: 1459: 1454: 1447: 1443: 1439: 1434: 1429: 1424: 1419: 1413: 1409: 1403: 1400: 1397: 1394: 1391: 1386: 1382: 1378: 1373: 1370: 1367: 1363: 1359: 1356: 1354: 1352: 1349: 1346: 1343: 1340: 1339: 1335: 1330: 1324: 1320: 1315: 1308: 1304: 1300: 1295: 1290: 1285: 1279: 1275: 1270: 1263: 1259: 1255: 1250: 1245: 1241: 1237: 1231: 1227: 1222: 1215: 1211: 1207: 1202: 1197: 1193: 1189: 1183: 1179: 1174: 1167: 1163: 1159: 1154: 1149: 1144: 1138: 1134: 1128: 1125: 1122: 1119: 1116: 1111: 1107: 1103: 1098: 1095: 1092: 1088: 1084: 1081: 1079: 1077: 1074: 1071: 1068: 1065: 1064: 1060: 1054: 1050: 1045: 1038: 1034: 1030: 1025: 1020: 1015: 1009: 1005: 1000: 993: 989: 985: 980: 975: 969: 965: 959: 956: 953: 950: 947: 942: 938: 934: 929: 926: 923: 919: 915: 912: 910: 908: 905: 902: 899: 896: 895: 892: 889: 886: 883: 878: 875: 871: 867: 864: 861: 858: 853: 849: 844: 839: 835: 831: 825: 821: 816: 812: 809: 804: 800: 795: 788: 784: 780: 775: 770: 765: 759: 755: 749: 746: 743: 740: 737: 732: 728: 724: 719: 716: 713: 709: 705: 702: 700: 698: 695: 692: 689: 688: 663: 660: 657: 643: 640: 624: 618: 589: 584: 578: 530:0 (decimal 8) 506: 500:0 (decimal 6) 487: 461: 458: 432: 413: 388: 385: 379: 357: 325:0 (decimal 2) 312: 286: 256: 253: 238:NOT x = -x − 1 228: 217: 207:that performs 186: 183: 177: 174: 150:binary numeral 140:operates on a 117: 116: 31: 29: 22: 15: 13: 10: 9: 6: 4: 3: 2: 4166: 4155: 4152: 4150: 4147: 4145: 4142: 4141: 4139: 4129: 4125: 4122: 4118: 4114: 4112: 4109: 4106: 4103: 4100: 4097: 4096: 4092: 4082: 4079: 4073: 4070: 4064: 4061: 4049: 4043: 4040: 4036: 4035:W3Schools.com 4032: 4027: 4024: 4019: 4015: 4009: 4007: 4003: 4000: 3994: 3991: 3979: 3973: 3971: 3967: 3955: 3949: 3946: 3934: 3928: 3925: 3913: 3907: 3905: 3901: 3889: 3883: 3880: 3868: 3864: 3858: 3855: 3844: 3840: 3834: 3831: 3827: 3822: 3820: 3816: 3804: 3798: 3795: 3788: 3783: 3780: 3778: 3775: 3773: 3770: 3768: 3765: 3763: 3760: 3758: 3757:Double dabble 3755: 3753: 3750: 3748: 3745: 3743: 3740: 3738: 3735: 3734: 3729: 3722: 3717: 3712: 3707: 3702: 3697: 3692: 3687: 3686: 3685: 3681: 3673: 3666: 3663: 3660: 3657: 3656: 3654: 3649: 3646: 3643: 3640: 3639: 3637: 3636: 3635: 3628: 3621: 3616: 3611: 3606: 3601: 3596: 3591: 3586: 3581: 3580: 3576: 3569: 3564: 3563: 3562: 3554: 3549: 3546:x ^ y ^ y = x 3544: 3539: 3534: 3531:x ^ y = y ^ x 3529: 3528: 3524: 3517: 3516: 3512: 3505: 3500: 3495: 3490: 3487:x | y = y | x 3485: 3484: 3480: 3475:x & x = x 3473: 3472: 3468:x & 0 = 0 3466: 3461: 3456: 3451: 3450: 3446: 3444: 3442: 3438: 3432: 3424: 3346: 3235: 3230:greater than 3217: 3213: 3207: 3201: 3197: 3194: 3191: 3188: 3187: 3183: 3159: 3157: 3153: 3137: 3133: 3132:Object Pascal 3125: 3123: 3121: 3117: 3110: 3058: 3052: 3047: 3044: 3040: 3033:The value of 3032: 3028: 3024: 2993: 2990: 2974: 2973: 2972: 2969: 2951: 2943: 2941: 2939: 2935: 2932:in Microsoft 2931: 2927: 2923: 2920:implementing 2919: 2835: 2833: 2829: 2824: 2729: 2630: 2620: 2616: 2600: 2598: 2595: 2593: 2588: 2555: 2541: 2538: 2530: 2528: 2526: 2521: 2519: 2515: 2511: 2499: 2494: 2491: 2479: 2475: 2469: 2465: 2464: 2458: 2456: 2454: 2450: 2437: 2433: 2427: 2423: 2422: 2416: 2414: 2412: 2408: 2404: 2398: 2390: 2388: 2386: 2380: 2378: 2377:logical shift 2365: 2361: 2355: 2351: 2350: 2346: 2345:Logical shift 2339:Logical shift 2338: 2336: 2334: 2330: 2326: 2322: 2318: 2314: 2310: 2303: 2298: 2296: 2288: 2281: 2276: 2273: 2271: 2267: 2258: 2250: 2245: 2237: 2228: 2226: 2225: 2221: 2218: 2215: 2214: 2210: 2208: 2207: 2203: 2200: 2199:Little-endian 2197: 2196: 2193: 2192: 2191: 2188: 2184: 2175: 2173: 2170: 2166: 2162: 2154: 2145: 2140: 2133: 2128: 2121: 2116: 2109: 2104: 2097: 2092: 2085: 2078: 2071: 2064: 2057: 2052: 2046: 2042: 2039: 2036: 2033: 2030: 2027: 2024: 2021: 2018: 2015: 2012: 2009: 2006: 2003: 2000: 1997: 1994: 1991: 1990: 1986: 1983: 1980: 1977: 1974: 1971: 1968: 1965: 1962: 1959: 1956: 1953: 1950: 1947: 1944: 1941: 1938: 1935: 1934: 1930: 1927: 1924: 1921: 1918: 1915: 1912: 1909: 1906: 1903: 1900: 1897: 1894: 1891: 1888: 1885: 1882: 1879: 1878: 1874: 1871: 1868: 1865: 1862: 1859: 1856: 1853: 1850: 1847: 1844: 1841: 1838: 1835: 1832: 1829: 1826: 1823: 1822: 1819: 1816: 1814: 1811: 1809: 1806: 1804: 1801: 1799: 1796: 1794: 1791: 1789: 1786: 1784: 1781: 1777: 1774: 1772: 1769: 1767: 1766: 1762: 1760: 1757: 1755: 1754: 1750: 1748: 1745: 1743: 1740: 1738: 1735: 1731: 1728: 1726: 1723: 1722: 1719: 1716: 1714: 1710: 1706: 1698: 1677: 1671: 1662: 1657: 1650: 1646: 1642: 1637: 1633: 1629: 1622: 1618: 1614: 1609: 1604: 1599: 1593: 1589: 1577: 1571: 1566: 1562: 1553: 1550: 1547: 1543: 1539: 1535: 1529: 1520: 1515: 1509: 1500: 1493: 1489: 1485: 1480: 1475: 1471: 1467: 1461: 1452: 1445: 1441: 1437: 1432: 1427: 1422: 1417: 1411: 1407: 1395: 1389: 1384: 1380: 1371: 1368: 1365: 1361: 1357: 1355: 1350: 1347: 1344: 1341: 1333: 1328: 1322: 1313: 1306: 1302: 1298: 1293: 1288: 1283: 1277: 1268: 1261: 1257: 1253: 1248: 1243: 1239: 1235: 1229: 1220: 1213: 1209: 1205: 1200: 1195: 1191: 1187: 1181: 1172: 1165: 1161: 1157: 1152: 1147: 1142: 1136: 1132: 1120: 1114: 1109: 1105: 1096: 1093: 1090: 1086: 1082: 1080: 1075: 1072: 1069: 1066: 1058: 1052: 1043: 1036: 1032: 1028: 1023: 1018: 1013: 1007: 998: 991: 987: 983: 978: 973: 967: 963: 951: 945: 940: 936: 927: 924: 921: 917: 913: 911: 906: 903: 900: 897: 890: 887: 884: 881: 876: 873: 869: 862: 856: 851: 847: 842: 837: 833: 829: 823: 814: 810: 807: 802: 793: 786: 782: 778: 773: 768: 763: 757: 753: 741: 735: 730: 726: 717: 714: 711: 707: 703: 701: 696: 693: 690: 679: 678: 677: 661: 658: 655: 641: 639: 637: 622: 605: 587: 582: 566: 563:-dimensional 562: 558: 557:machine words 554: 549: 546: 542: 538: 534: 529: 525: 521: 517: 513: 509: 505: 499: 495: 491: 486: 483: 479: 475: 466: 459: 455: 451: 447: 443: 439: 435: 431: 425: 421: 417: 412: 410: 406: 402: 393: 386: 384: 378: 376: 369: 365: 361: 356: 352: 350: 349:Boolean state 346: 341: 339: 335: 331: 324: 320: 316: 311: 309: 305: 298: 294: 290: 285: 282: 278: 274: 266: 261: 254: 252: 246: 243:For unsigned 241: 235: 225: 221: 216: 214: 210: 206: 202: 198: 192: 184: 182: 175: 173: 171: 170:architectural 167: 161: 159: 155: 151: 147: 143: 139: 135: 128: 127:Offset binary 124: 113: 110: 102: 91: 88: 84: 81: 77: 74: 70: 67: 63: 60: –  59: 55: 54:Find sources: 48: 44: 38: 37: 32:This article 30: 26: 21: 20: 4081: 4072: 4063: 4052:. Retrieved 4042: 4034: 4026: 4017: 3993: 3982:. Retrieved 3958:. Retrieved 3948: 3937:. Retrieved 3927: 3916:. Retrieved 3892:. Retrieved 3882: 3871:. Retrieved 3866: 3857: 3846:. Retrieved 3842: 3833: 3807:. Retrieved 3797: 3767:Karnaugh map 3683: 3650:Rotate right 3638:Has inverse 3632: 3560: 3441:machine code 3434: 3336: 3208: 3205: 3202:Applications 3155: 3151: 3129: 3114: 3056: 3050: 3042: 3038: 3016:>>> 2988: 2985:>>> 2970: 2966:<<< 2962:>>> 2947: 2915: 2825: 2821: 2707: 2604: 2596: 2589: 2578: 2545: 2522: 2517: 2513: 2497: 2495: 2489: 2488: 2453:cryptography 2448: 2446: 2411:bit rotation 2410: 2406: 2402: 2400: 2381: 2376: 2374: 2316: 2308: 2306: 2301: 2291: 2286: 2279: 2274: 2265: 2263: 2179: 2164: 2160: 2158: 2050:equivalents 1764: 1752: 1729: 1724: 1717: 1702: 645: 565:vector space 560: 552: 550: 535: 532: 527: 523: 519: 515: 511: 507: 502: 497: 493: 489: 473: 471: 453: 449: 445: 441: 437: 433: 428: 426:(decimal 7) 423: 419: 415: 400: 398: 382: 372: 367: 363: 359: 353: 342: 337: 334:masking tape 329: 327: 322: 318: 314: 307: 303: 301: 299:(decimal 1) 296: 292: 288: 272: 270: 242: 231: 223: 219: 200: 196: 194: 179: 162: 137: 131: 105: 96: 86: 79: 72: 65: 53: 41:Please help 36:verification 33: 3890:. Microsoft 3805:. CMicrotek 3667:Shift right 3655:No inverse 3647:Rotate left 3122:to 1 or 0. 3120:units place 1713:truth table 474:bitwise XOR 336:covers, or 330:bit masking 281:logical AND 273:bitwise AND 197:bitwise NOT 99:August 2018 4138:Categories 4054:2014-03-08 4018:oracle.com 3984:2015-08-11 3960:2015-08-12 3939:2015-08-11 3918:2015-08-12 3894:2013-07-14 3873:2015-09-07 3848:2016-07-06 3809:2015-08-12 3789:References 3772:Logic gate 3699:* / % 3664:Shift left 3212:pseudocode 3116:JavaScript 3111:JavaScript 2938:intrinsics 2934:Visual C++ 2918:intrinsics 2512:just have 2295:carry flag 2219:ordering: 2217:Big-endian 2201:ordering: 2187:big-endian 2161:bit shifts 2155:Bit shifts 401:bitwise OR 189:See also: 168:and other 142:bit string 69:newspapers 3551:x ^ x = 0 3541:x ^ 0 = x 3519:~(~x) = x 3507:x | x = x 3497:x | 0 = x 2611:std::rotr 2607:std::rotl 2525:word size 2496:A single 2169:Registers 2113:(p XOR q) 2101:(p AND q) 1584:⌋ 1572:⁡ 1559:⌊ 1544:∑ 1402:⌋ 1390:⁡ 1377:⌊ 1362:∑ 1348:⁡ 1240:− 1127:⌋ 1115:⁡ 1102:⌊ 1087:∑ 1073:⁡ 958:⌋ 946:⁡ 933:⌊ 918:∑ 904:⁡ 888:− 882:− 857:⁡ 748:⌋ 736:⁡ 723:⌊ 708:∑ 694:⁡ 659:≥ 646:Assuming 602:over the 541:compilers 158:processor 146:bit array 3747:Bitboard 3730:See also 3190:popcount 2981:>> 2977:<< 2958:>> 2954:<< 2893:>> 2875:<< 2860:uint32_t 2839:uint32_t 2793:>> 2775:<< 2754:uint32_t 2733:uint32_t 2716:because 2688:>> 2670:<< 2655:uint32_t 2634:uint32_t 2579:assigns 2568:<< 2552:>> 2548:<< 2313:overflow 2270:sign bit 2123:(NOT p) 2066:(NOT p) 2061:(p OR q) 2048:Bitwise 1658:⌋ 1638:⌊ 1630:⌋ 1610:⌊ 1501:⌋ 1481:⌊ 1453:⌋ 1433:⌊ 1314:⌋ 1294:⌊ 1269:⌋ 1249:⌊ 1221:⌋ 1201:⌊ 1173:⌋ 1153:⌊ 1044:⌋ 1024:⌊ 999:⌋ 979:⌊ 870:⌋ 843:⌊ 794:⌋ 774:⌊ 545:register 267:integers 245:integers 3142:" and " 3104:i == -5 2956:" and " 2924:, like 2165:shifted 2137:(NOT q) 2106:p AND q 2094:p XOR q 2082:(NOT q) 1808:Then/if 1798:If/then 1707:of two 674:⁠ 648:⁠ 308:cleared 306:(1) or 203:, is a 83:scholar 4105:XORcat 3577:Others 3416:return 3329:return 3126:Pascal 3096:0x0200 2724:, and 2718:32 - 0 2514:rotate 2417:Rotate 2264:In an 2142:p OR q 2080:p AND 555:(i.e. 375:parity 85:  78:  71:  64:  56:  3714:& 3395:shift 3350:while 3317:shift 3314:right 3302:shift 3248:while 3184:Other 3010:aByte 2905:& 2832:Clang 2375:In a 2325:floor 2319:of a 2135:p OR 2068:AND q 604:field 476:is a 403:is a 345:flags 338:masks 275:is a 265:4-bit 199:, or 148:or a 90:JSTOR 76:books 3392:left 3341:and 3299:left 3222:and 3134:and 3063:byte 3051:byte 2950:Java 2944:Java 2857:...; 2848:..., 2830:and 2751:...; 2742:..., 2652:...; 2643:..., 2617:and 2609:and 2516:and 2510:PICs 2159:The 2125:OR q 2111:NOT 2099:NOT 2087:NOT 2073:NOT 2059:NOT 1788:XNOR 1776:NAND 218:NOT 195:The 154:bits 144:, a 136:, a 62:news 3704:+ - 3694:~ - 3689:( ) 3658:AND 3644:XOR 3641:NOT 3525:XOR 3513:NOT 3447:AND 3386:xor 3371:and 3269:and 3172:shl 3148:shr 3144:shr 3140:shl 3081:int 3057:int 3037:is 3004:int 2948:In 2911:)); 2828:GCC 2720:is 2703:)); 2625:by 2409:or 1783:AND 1771:XOR 1742:NOR 1668:mod 1563:log 1526:mod 1506:mod 1458:mod 1381:log 1345:XOR 1319:mod 1274:mod 1226:mod 1178:mod 1106:log 1049:mod 1004:mod 937:log 901:AND 848:log 820:mod 799:mod 727:log 691:NOT 460:XOR 424:111 420:011 416:101 304:set 287:010 255:AND 185:NOT 132:In 45:by 4140:: 4033:. 4016:. 4005:^ 3969:^ 3903:^ 3865:. 3841:. 3818:^ 3661:OR 3481:OR 3401:by 3323:by 3308:by 3260:if 3166::= 3090:b1 3066:b1 3001:(( 2940:. 2928:, 2908:31 2808:)) 2799:32 2726:32 2722:32 2694:32 2455:. 2413:. 2405:, 2335:. 2302:00 2043:1 1995:0 1987:1 1939:1 1931:1 1883:0 1875:1 1827:1 1813:OR 1765:¬q 1753:¬p 1747:Xq 1715:. 1070:OR 498:11 494:01 490:10 472:A 399:A 387:OR 313:00 271:A 240:. 4126:" 4123:. 4115:" 4057:. 4037:. 4020:. 3987:. 3963:. 3942:. 3921:. 3897:. 3876:. 3851:. 3812:. 3724:| 3719:^ 3419:b 3413:c 3410:← 3407:a 3404:1 3398:c 3389:a 3383:b 3380:← 3377:b 3374:a 3368:b 3365:← 3362:c 3359:0 3356:≠ 3353:a 3343:b 3339:a 3332:c 3326:1 3320:b 3311:1 3305:a 3296:a 3293:+ 3290:c 3287:← 3284:c 3281:0 3278:≠ 3275:) 3272:1 3266:b 3263:( 3257:0 3254:≠ 3251:b 3245:0 3242:← 3239:c 3232:b 3228:a 3226:( 3224:b 3220:a 3178:; 3175:2 3169:y 3163:x 3156:y 3152:x 3106:. 3099:; 3093:| 3087:= 3084:i 3078:; 3075:5 3072:- 3069:= 3043:s 3039:n 3022:. 3019:2 3013:) 3007:) 2991:. 2902:n 2899:- 2896:( 2890:x 2887:( 2884:| 2881:) 2878:n 2872:x 2869:( 2866:= 2863:y 2854:= 2851:n 2845:= 2842:x 2817:; 2814:x 2811:: 2805:n 2802:- 2796:( 2790:x 2787:( 2784:| 2781:) 2778:n 2772:x 2769:( 2766:? 2763:n 2760:= 2757:y 2748:= 2745:n 2739:= 2736:x 2710:0 2700:n 2697:- 2691:( 2685:x 2682:( 2679:| 2676:) 2673:n 2667:x 2664:( 2661:= 2658:y 2649:= 2646:n 2640:= 2637:x 2627:n 2623:x 2585:y 2581:x 2574:; 2571:2 2565:y 2562:= 2559:x 2317:n 2309:n 2287:1 2280:0 2147:1 2130:p 2118:q 2089:q 2075:p 2054:0 2040:0 2037:1 2034:0 2031:1 2028:0 2025:1 2022:0 2019:1 2016:0 2013:1 2010:0 2007:1 2004:0 2001:1 1998:0 1992:0 1984:1 1981:0 1978:0 1975:1 1972:1 1969:0 1966:0 1963:1 1960:1 1957:0 1954:0 1951:1 1948:1 1945:0 1942:0 1936:0 1928:1 1925:1 1922:1 1919:0 1916:0 1913:0 1910:0 1907:1 1904:1 1901:1 1898:1 1895:0 1892:0 1889:0 1886:0 1880:1 1872:1 1869:1 1866:1 1863:1 1860:1 1857:1 1854:1 1851:0 1848:0 1845:0 1842:0 1839:0 1836:0 1833:0 1830:0 1824:1 1818:T 1803:p 1793:q 1759:↛ 1737:F 1730:q 1725:p 1678:] 1672:2 1663:) 1651:n 1647:2 1643:y 1634:+ 1623:n 1619:2 1615:x 1605:( 1600:[ 1594:n 1590:2 1581:) 1578:x 1575:( 1567:2 1554:0 1551:= 1548:n 1540:= 1536:) 1530:2 1521:] 1516:) 1510:2 1494:n 1490:2 1486:y 1476:( 1472:+ 1468:) 1462:2 1446:n 1442:2 1438:x 1428:( 1423:[ 1418:( 1412:n 1408:2 1399:) 1396:x 1393:( 1385:2 1372:0 1369:= 1366:n 1358:= 1351:y 1342:x 1334:) 1329:) 1323:2 1307:n 1303:2 1299:y 1289:( 1284:) 1278:2 1262:n 1258:2 1254:x 1244:( 1236:) 1230:2 1214:n 1210:2 1206:y 1196:( 1192:+ 1188:) 1182:2 1166:n 1162:2 1158:x 1148:( 1143:( 1137:n 1133:2 1124:) 1121:x 1118:( 1110:2 1097:0 1094:= 1091:n 1083:= 1076:y 1067:x 1059:) 1053:2 1037:n 1033:2 1029:y 1019:( 1014:) 1008:2 992:n 988:2 984:x 974:( 968:n 964:2 955:) 952:x 949:( 941:2 928:0 925:= 922:n 914:= 907:y 898:x 891:x 885:1 877:1 874:+ 866:) 863:x 860:( 852:2 838:2 834:= 830:] 824:2 815:) 811:1 808:+ 803:2 787:n 783:2 779:x 769:( 764:[ 758:n 754:2 745:) 742:x 739:( 731:2 718:0 715:= 712:n 704:= 697:x 662:y 656:x 623:2 617:F 588:n 583:2 577:F 561:n 553:n 528:0 526:0 524:1 520:1 518:0 516:1 512:1 510:0 508:0 488:0 454:1 452:0 450:1 446:0 444:0 442:1 438:1 436:0 434:0 414:0 368:0 364:0 360:1 358:0 323:1 319:1 315:1 297:1 293:1 289:1 224:1 220:0 129:. 112:) 106:( 101:) 97:( 87:· 80:· 73:· 66:· 39:.

Index


verification
improve this article
adding citations to reliable sources
"Bitwise operation"
news
newspapers
books
scholar
JSTOR
Learn how and when to remove this message
Shifted binary (code)
Offset binary
computer programming
bit string
bit array
binary numeral
bits
processor
instruction pipelines
architectural
Ones' complement
unary operation
logical negation
ones' complement
two's complement
integers

4-bit
binary operation

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.