markhyde

RESETTING MULTIPLE BOOLEANS

4 posts in this topic

Can anyone advise how to reset multiple Booleans at the same time. I have created a structure of  Booleans and need to reset then all to false but cannot find and instruction to do this.

Share this post


Link to post
Share on other sites

Try creating a union in the Data Types. For example, a union of 32 BOOLS and a single DWORD.

Then you can write 0 to the DWORD and all 32 bits will be reset.

Share this post


Link to post
Share on other sites

Or just use the clear function.  No need to do a union.

clear.jpg.4af9a58046a861e8cd07836ec18910

Testarray is of type BOOL[10]

It also works with structures:

592871ef0158f_clearstruct.jpg.6502649f5a

MyTestStruct looks like this:

strct.jpg.65ef0c0bfe6e4a6e766494480ca919

struct2.jpg.338adc35d4afdc3514c8340b298b

When the testbit turns on in the code above, all the bits turn off and all the INTs are set to 0.

1 person likes this

Share this post


Link to post
Share on other sites

Didn't realise it works like that for structures. Nice tip.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now