Read a BIT in the Integer variable

Discussion about recent product features & solutions!
2 posts • Page 1 of 1
s.godquin
Posts:1
Joined: Fri Nov 07, 2014 6:48 pm

Read a BIT in the Integer variable

Post by s.godquin »

hello,

Is there a request to know the state of a bit in an integer variable .

Example: < Variable Name > .X1
With X1 being the state of bit 1 of the variable ( INT format).

Thank you in advance

michel.eijgermans
Posts:46
Joined: Mon Aug 08, 2011 11:50 am

Re: Read a BIT in the Integer variable

Post by michel.eijgermans »

The getBit() function can be used. It receives a bit32 variable. The int-variable can be casted to a bit32 variable.

main()
{
int iInt = 32;
for (int i = 1; i < 10; i++)
{
DebugN("bitvalue:",getBit((bit32)iInt,i));
}
}

2 posts • Page 1 of 1