Hardware Support
Many architectures include instructions to rapidly perform find first set and/or related operations, listed below. The most common operation is count leading zeros (clz), likely because all other operations can be implemented efficiently in terms of it (see Properties and relations).
| Platform | Mnemonic | Name | Word sizes | Description | Result on zero input |
|---|---|---|---|---|---|
| Intel 386 and later | bsf | Bit Scan Forward | 16, 32, 64 | ctz | Undefined, sets zero flag |
| Intel 386 and later | bsr | Bit Scan Reverse | 16, 32, 64 | log base 2 | Undefined, sets zero flag |
| AMD supporting SSE4.2 | lzcnt | Count Leading Zeros | 16, 32, 64 | clz | input size, sets carry flag |
| Itanium | clz | Count Leading Zeros | 64 | clz | 64 |
| ARM 5 or later | clz | Count Leading Zeros | 32 | clz | 32 |
| IBM POWER/PowerPC | cntlz/cntlzw/cntlzd | Count Leading Zeros | 32, 64 | clz | input size |
| MIPS | clz | Count Leading Zeros in Word | 32, 64 | clz | input size |
| MIPS | clo | Count Leading Ones in Word | 32, 64 | clo | input size |
| DEC Alpha | ctlz | Count Leading Zero | 64 | clz | 64 |
| DEC Alpha | cttz | Count Trailing Zero | 64 | ctz | 64 |
| Motorola 68020 and later | bfffo | Find First One in Bit Field | arbitrary | log base 2 | field offset + field width |
Notes: On some Alpha platforms CTLZ and CTTZ are emulated in software.
Read more about this topic: Find First Set
Famous quotes containing the words hardware and/or support:
“A friend of mine spoke of books that are dedicated like this: To my wife, by whose helpful criticism ... and so on. He said the dedication should really read: To my wife. If it had not been for her continual criticism and persistent nagging doubt as to my ability, this book would have appeared in Harpers instead of The Hardware Age.”
—Brenda Ueland (18911985)
“They [parents] can help the children work out schedules for homework, play, and television that minimize the conflicts involved in what to do first. They can offer moral support and encouragement to persist, to try again, to struggle for understanding and mastery. And they can share a childs pleasure in mastery and accomplishment. But they must not do the job for the children.”
—Dorothy H. Cohen (20th century)