Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, 1 invisible), 18,789 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 3 1 2 3
Re: Super-small var-type? [Re: Alan] #308854
02/05/10 14:01
02/05/10 14:01
Joined: Oct 2007
Posts: 306
Austria
A
Alan Offline OP
Senior Member
Alan  Offline OP
Senior Member
A

Joined: Oct 2007
Posts: 306
Austria
Hi,

I hate to say this, but bitfields don't work with Lite-C.

Code:
typedef struct
{
int some_value;
unsigned int my_flag1 : 1;
}my_struct;



... won't compile in Lite-C (at least, not on my end here, commercial edition).
I will now try using the bitshifting stuff with defines.


Alan






EDIT: Bitshifting seems to work. I can set and re-set my boolean values now without trouble. The thing is... how do I READ them out of the int variable? For flags, there's the predefined "is()" function, unfortunately it applies to engine objects ONLY. I really can't figure out how to read a variable bit-whise...

Last edited by Alan; 02/05/10 15:07.
Re: Super-small var-type? [Re: Alan] #308880
02/05/10 15:51
02/05/10 15:51
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
use bitwise and. if you want to read out the sixth bit from the right, use

if (myflaginteger & (1 << 6))

Re: Super-small var-type? [Re: Joey] #308883
02/05/10 16:02
02/05/10 16:02
Joined: Dec 2008
Posts: 271
Saturnus Offline
Member
Saturnus  Offline
Member

Joined: Dec 2008
Posts: 271
And you could also have a look at... well, right know I can't remeber which file it actually was. acknex.h, atypes.h, afuncs.c or something like this. You can find them in the include directory. In one of these files the macros set, is etc. are defined and you can see what they do.

Re: Super-small var-type? [Re: Saturnus] #309371
02/08/10 22:37
02/08/10 22:37
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
they do just that:

if (myflaginteger & MYFLAG)

Page 3 of 3 1 2 3

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1