• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[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