Skip to main content
gamedev.net
🔒 Locked

Problem with binary &

Started by Oberon_Command Jan 26, 2006 at 12:37 PM 2 replies 450+ views
Original Post
Oberon_Command
Oberon_Command
I'm currently writing the memory management section of my operating system, but I've got a problem with my malloc() function. Specifically, the compiler doesn't like my use of the binary AND operator here:

if ((currentMemory & (1<<loops)) == (1<<loops))
To the best of my knowledge, this is a correct statement. Even when I replace the whole (1<<loops) thing with a constant, it still spits out the same error. Can anybody tell me what is wrong with this statement?
JohnBolton
JohnBolton
What is the error?
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
ZQJ
ZQJ
Is currentMemory a pointer? You can only use the binary & operator on integer types.
Oberon_Command
Oberon_Command
Quote:
Original post by ZQJ
Is currentMemory a pointer? You can only use the binary & operator on integer types.


That was it! Thanks a lot, that had me puzzled for a while.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.