Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/06/23 11:29
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
7 registered members (3run, miwok, AndrewAMD, Quad, TipmyPip, fairtrader, 1 invisible), 637 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 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 | chip programmers | 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