Closed steam3d closed 3 years ago
You're right. It must be a leftover from some test that I was doing, I'll remove it.
but if char is 1 or 5 the result is different
You can see that it is not the same: the left result is the original
0: 0 - 0
1: 0 - 1
2: 1 - 1
3: 1 - 1
4: 0 - 1
5: 0 - 1
6: 1 - 1
7: 1 - 1
8: 0 - 1
9: 0 - 1
A: 1 - 1
B: 1 - 1
C: 0 - 1
D: 0 - 1
E: 1 - 1
F: 1 - 1
0: 10000 - 0
1: 10001 - 1
2: 10010 - 10
3: 10011 - 11
4: 10100 - 100
5: 10101 - 101
6: 10110 - 110
7: 10111 - 111
8: 11000 - 1000
9: 11001 - 1001
A: 11010 - 1010
B: 11011 - 1011
C: 11100 - 1100
D: 11101 - 1101
E: 11110 - 1110
F: 11111 - 1111
You are right, I forget write that you need to fill zeros to xxxx format. I think this is wrong just add 0x10 to char. It is confusing.
private boolean isFlipped (String str) {
return ((Integer.parseInt("" + str.charAt(10), 16) / 2 ) % 2) == 0;
}
This would probably be a better idea
This could be rewritten better as
return (Integer.parseInt(""+str.charAt(10),16) & 0x02)!=0;
since we're just interested to the value of a single bit.
I have no idea what I was thinking when I wrote that last year.
Do you mean this?
return (Integer.parseInt("" + str.charAt(10), 16) & 0x02) == 0;
Yes, my bad. I'm fucking retarded today.
done that in ea1743a
Why did you sum 0x10 to char?
For example char is 2
It does not matter if you take char(3) from 10010 or take char(0) from 10