Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*=============================================================================
- @ flipBits
- - Params: %0 - %1 (val1 and val2)
- - Note: Only execute xor between 2 val
- - Credits: DraKiNs
- //=============================================================================*/
- #define flipBits(%0, %1) ((%0)^(%1))
- /*=============================================================================
- @ getColours
- - Params: %0 - %1 - %2 - %3 - %4 (hexcolor - r - g - b - a)
- - Note: Convert Hexadecimal Colour to RGBA
- - Credits: DraKiNs
- //=============================================================================*/
- #define getColours(%0,%1,%2,%3,%4) ((%1 = (%0 >> 24) & 0xFF),(%2 = (%0 >> 16) & 0xFF),(%3 = (%0 >> 8) & 0xFF),(%4 = (%0 & 0xFF)))
- /*=============================================================================
- @ setColours
- - Params: %0 - %1 - %2 - %3 - %4 (hexcolor - r - g - b - a)
- - Note: Convert RGBA Colour to Hexadecimal
- - Credits: DraKiNs
- //=============================================================================*/
- #define setColours(%0,%1,%2,%3,%4) ((%1 << 0x18)|(%2 << 0x10)|(%3 << 0x8)|(%4))
- /*=============================================================================
- @ swap
- - Params: %0 - %1 (val1 - val2)
- - Note: Alternate value between 2 values
- - Credits: DraKiNs (wiki help)
- //=============================================================================*/
- #define add_swap(%0,%1) ((%0 != %1) ? (%0 = (%0 + %1) ,%1 = (%0 - %1) ,%0 = (%0 - %1)) : (false))
- #define xor_swap(%0,%1) ((%0 != %1) ? (%0 ^= %1, %1 ^= %0, %0 ^= %1) : (false))
- #define x_swap(%0,%1) (%0 ^= %1, %1 ^= %0, %0 ^= %1)
- #define a_swap(%0,%1) (%0 = (%0 + %1) ,%1 = (%0 - %1) ,%0 = (%0 - %1))
- /*=============================================================================
- @ foreach
- - Params: %0 - %1 (iter - array)
- - Note: Make circuit in Array (basic)
- - Credits: DraKiNs
- //=============================================================================*/
- #define foreach(%0,%1) for(new %0,_%0; _%0 != sizeof %1; %0 = %1[_%0], ++_%0)
- /*=============================================================================
- @ setEnum
- - Params: %0- %1 - %3 - %4 (array - enum - value)
- - Note: setAll enum for onlny one value (best method thans ilusion)
- - Credits: DraKiNs (thanks Y_less)
- //=============================================================================*/
- #define setEnum(%0,%1 ,%3) { for(new i__ = 0; i__ < _: %1; ++i__ ) %0[%1:i__ ] = _:%3 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement