[Snippet] LeftShift

JASS:
/************************************************
*
*   LeftShift
*   v1.2.0.0
*   By Magtheridon96
*
*   - Used to perform the bitwise LEFTSHIFT
*     operation for 8 bits. (1 byte)
*
*   Requires:
*   ---------
*
*       BitManip by Nestharus
*           - [url]http://www.hiveworkshop.com/forums/jass-resources-412/snippet-bit-manip-226117/[/url]
*
*   API:
*   ----
*
*       function B_LEFTSHIFT takes integer byte, integer n returns integer
*           - Returns (byte << n)
*           - The arguments must be in the range [0x00 ... 0xff]
*           - The return value will be in the range [0x00 ... 0xff]
*   
************************************************/
library LeftShift requires BitManip
    
    function B_LEFTSHIFT takes integer byte, integer n returns integer
        set byte = LeftShift(byte, n)
        return byte - byte / 256 * 256
    endfunction
    
endlibrary

Yet another Bitwise operation snippet.

Feel free to comment..
 
Last edited:
Top