Jump to content
  • Advertisement
Sign in to follow this  
Shadowraix

Any Advantages to use Hexadecimals?

This topic is 1822 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

So, just for the fun of it, I learned how to convert numbers into hexadecimals just so I can use it in math operations to confuse those who don't understand it. Although, are there any advantages to coding in hexadecimals compared to regular numbers? Wouldn't it be faster? Right now I would be using it in Lua as that's the only programming language I can code in fluently at the moment.

Share this post


Link to post
Share on other sites
Advertisement
Faster? No, not at all. It's easy to convert back and forth between binary and hexadecimal (each hexadecimal digit corresponds to 4 binary digits), and it's friendlier to humans to type "830f" instead of "1000001100001111".

If you write code that does heavy use of bit manipulations (e.g., bitboards in chess), you'll find yourself using hexadecimal constants all the time. Edited by Álvaro

Share this post


Link to post
Share on other sites

We chatted a little about the benefits of hexadecimal here.

 

Hexadecimal and binary and decimal and octal is converted to the integer's binary format when the program is compiled. It's just a more convenient presentation (to the programmer) because of the power-of-two binary nature of computers.

 

I could sit and convert binary and hexadecimal to decimal, or vise-versa but it'd take me about a minute for hexadecimal values. Nevertheless, I still find it useful when doing things like bit-wise operations on numbers, or as a convenient shorthand for RGBA values.

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!