SA-MP Forums Archive
BitFields? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: BitFields? (/showthread.php?tid=607400)



BitFields? - kartik - 19.05.2016

Does Pawn have support for bitfields.

I want to keep a status array thing and it would be major convenience to be able to binary operations directly on that array. Will also save a lot of memory.. Help please?

basically I wan't to be able to keep an array of bits and manip them directly.
Considering and integer is 4/8 bytes..so much waste


Re: BitFields? - Sithis - 19.05.2016

Check this out:
[Tutorial] An in-depth look at binary and binary operators.
Binary - SA-MP Wiki


Re: BitFields? - kartik - 19.05.2016

Thanks for the link, but I wanted something that would allow me to create/manip bit arrays. I know 8 is 0100 and I know the theory behind binary maths. That's not the problem.
Say i had number of yes/no player variables- I want to store them in a bit array. I can't know the value in advance so i can't just magic number them


Re: BitFields? - paul988 - 19.05.2016

Have you tried rBits? Might be what you are looking for, take a look: https://sampforum.blast.hk/showthread.php?tid=275142


Re: BitFields? - kartik - 19.05.2016

Thanks, my friend


Re: BitFields? - AbyssMorgan - 19.05.2016

https://sampforum.blast.hk/showthread.php?tid=591223