Programming Topics (Computer Chess) and technical aspects as test techniques, book building, program tuning etc
Moderator: Andres Valverde
by BrettVsop » 13 Nov 2007, 06:16
I am compiling in Visual Studios C++ Version 6 and have noticed a problem with the not command. It only reverses the significant digits. Is there a way to make the compiler reverse all digits?
I am currently using a effective work around. I have a constant that has all the digits set to one, and I XOR the variable with the constant. I would prefer to use the unary operator however.
-
BrettVsop
-
- Posts: 50
- Joined: 04 Nov 2007, 18:32
by rjgibert » 13 Nov 2007, 07:14
The bitwise not operator is "~" and must not be confused with the logical not operator "!" which treats the entire value as a boolean. The logical not is not a bitwise operation.
-
rjgibert
-
- Posts: 4
- Joined: 11 Mar 2006, 12:53
by Dann Corbit » 13 Nov 2007, 07:37
BrettVsop wrote:I am compiling in Visual Studios C++ Version 6 and have noticed a problem with the not command. It only reverses the significant digits. Is there a way to make the compiler reverse all digits?
I am currently using a effective work around. I have a constant that has all the digits set to one, and I XOR the variable with the constant. I would prefer to use the unary operator however.
Are you using a big enough type to create your mask? Show us the code that is not doing what you think it ought to do.
-
Dann Corbit
-
by BrettVsop » 13 Nov 2007, 08:11
typedef unsigned __int64 BITBOARD;
const BITBOARD FULLBOARD = 0xFFFFFFFFFFFFFFFF;
rj saw the problem. I wasn't thinking and used the ! statement.
Thanks
-
BrettVsop
-
- Posts: 50
- Joined: 04 Nov 2007, 18:32
Return to Programming and Technical Discussions
Who is online
Users browsing this forum: No registered users and 29 guests