AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   bitsum to flags? (https://forums.alliedmods.net/showthread.php?t=85776)

Exolent[jNr] 02-15-2009 20:37

bitsum to flags?
 
Is there a snippet/function that converts a bitsum to a-z flags?
I made my own, but I wanted to know if one already existed in a better form:
Code:
bits_to_flags(const bits, flags[], len) {     static const letters[][] =     {         "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",         "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"     }         flags[0] = 0;     for( new i = 0; i < sizeof(letters); i++ )     {         if( bits & (1<<i) )         {             add(flags, len, letters[i]);         }     } }

Arkshine 02-15-2009 20:42

Re: bitsum to flags?
 
get_flags()

Exolent[jNr] 02-15-2009 20:51

Re: bitsum to flags?
 
Wow, I'm stupid. Thanks, arkshine.


All times are GMT -4. The time now is 16:56.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.