I have two oppositions to this. First, I'd like to be able to do this in pure C. Second, this appears to be a byte-level operation, but the whole point of doing this is to work on multiple bytes simultaneously.

I think I might be able to do it with a subtraction and two bitshifts, though. Think that would be meaningfully faster?


Happy Hacking,

David E. McMackins II
Supporting Member, Electronic Frontier Foundation (#2296972)
Associate Member, Free Software Foundation (#12889)

www.mcmackins.org www.delwink.com
www.eff.org www.gnu.org www.fsf.org

On 2018-07-23 11:44, Bret Johnson wrote:
One way around this might be to use CBW, which essentially copies the
high bit of AL into all the bits of AH. Using your example, if this is
the value in AL:

01011110
 ^ the alpha bit

You can put a saturated mask in AH with two instructions:

SHL AL,1

CBW

Or put a saturated mask in AH and leave AL unchanged with three
instructions:

ROL AL,1

CBW

ROR AL,1

Those instructions will work even on an 8086 CPU.

____________________________________________________________
UNDERGROUND TREATMENT MELTS TUMOR WITH NO CHEMO (WATCH)
pro.allianceforadvancedhealth.com
http://thirdpartyoffers.juno.com/TGL3142/5b560616f196e6162acbst04vuc
[1]


Links:
------
[1] http://thirdpartyoffers.juno.com/TGL3142/5b560616f196e6162acbst04vuc

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to