sarahc
Member
I have to check 1024 (sequential) bits for change of state in any of the bits and record which bit changed.
I was going to do something like this:
A = ARRAY[0..63] OF INT (gives me 1024 bits to check)
B = ARRAY[0..63] OF INT (reference array to compare against)
WordIndex = INT
BitIndex = INT
Res = INT (record bit location)
FOR (WordIndex :=0 TO 63) DO
FOR (BitIndex :=0 TO 15) DO
IF A[WordIndex].[BitIndex] NE B[WordIndex].[BitIndex] THEN
B[WordIndex].[BitIndex] := A[WordIndex].[BitIndex];
Res := (WordIndex*16) + BitIndex;
(other stuff) ;
END_IF;
END_FOR;
END_FOR;
Only problem is that Unity won't let me reference the bits in the word like this.
A[WordIndex].0 is fine, A[WordIndex].[BitIndex] is not.
Is my syntax wrong or is this not possible?
I was going to do something like this:
A = ARRAY[0..63] OF INT (gives me 1024 bits to check)
B = ARRAY[0..63] OF INT (reference array to compare against)
WordIndex = INT
BitIndex = INT
Res = INT (record bit location)
FOR (WordIndex :=0 TO 63) DO
FOR (BitIndex :=0 TO 15) DO
IF A[WordIndex].[BitIndex] NE B[WordIndex].[BitIndex] THEN
B[WordIndex].[BitIndex] := A[WordIndex].[BitIndex];
Res := (WordIndex*16) + BitIndex;
(other stuff) ;
END_IF;
END_FOR;
END_FOR;
Only problem is that Unity won't let me reference the bits in the word like this.
A[WordIndex].0 is fine, A[WordIndex].[BitIndex] is not.
Is my syntax wrong or is this not possible?