• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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