Knowledge (XXG)

Bitwise operation

Source 📝

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

Index

Bitwise NOT

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

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