Jump to content
  • Advertisement
Sign in to follow this  
Oberon_Command

Problem with binary &

This topic is 4560 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
Is currentMemory a pointer? You can only use the binary & operator on integer types.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!