Hmmm. Have to think that one through. Thanks. Charles
-----Original Message----- From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf Of Paul Gilmartin Sent: Tuesday, July 23, 2013 7:13 PM To: [email protected] Subject: Re: Is there a "reverse bits" hardware instruction? On Tue, 23 Jul 2013 17:49:00 -0400, Charles Mills wrote: > >Why? Those of you following another thread I started know I am looking >to implement a 64-bit version of the UNIX library function ffs(), which >returns the bit number of the least significant one bit of a word. z >architecture provides the FLOGR instruction but it works MSB to LSB. > Subtract 1. XOR with the original value. The leftmost 1 bit of the result now occupies the position of the rightmost 1 bit of the original value AND with the original value yields the mask to reset that bit. Zero must be treated as a special case. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
