Jump to content

Image of the Day

#animation 2/14

Sweet piggy, isn't it?

#gamedev #indiedev #indiegame #GamersUnite #screenshotsaturday #unity3d https://t.co/lscyvCxrPR
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net's newsletters to receive the latest updates and exclusive content.


Sign up now
- - - - -

Support for octals?

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
6 replies to this topic

#1 dkrusu   Members   

381
Like
0Likes
Like

Posted 10 December 2012 - 01:00 AM

It seems that angelscript doesn't support octals, any plans for this?

Krusu

#2 Andreas Jonsson   Moderators   

4553
Like
0Likes
Like

Posted 10 December 2012 - 06:49 AM

I don't have any plans to implement this myself. However, if you would like to do it and send me a patch I can certainly include it in the SDK.

Regards,
Andreas
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#3 dkrusu   Members   

381
Like
0Likes
Like

Posted 10 December 2012 - 05:31 PM

This was actually quite easy to implement. Any integer that is prefixed with a 0 is considered a octal just like in C. I added a simple test case, but I wasn't sure exactly where to stick it so I put it in test_bits.

Krusu

#4 dkrusu   Members   

381
Like
0Likes
Like

Posted 10 December 2012 - 05:35 PM

Forgot to check if the number is actually a valid octal (0-7), I'll upload the patch as soon as I fix this.

Edited by dkrusu, 10 December 2012 - 05:37 PM.


#5 dkrusu   Members   

381
Like
0Likes
Like

Posted 10 December 2012 - 05:52 PM

Okay, it now validates the octal. It does add another loop through the numbers, maybe you can think of a better way to validate it?

Attached Files



#6 Andreas Jonsson   Moderators   

4553
Like
0Likes
Like

Posted 11 December 2012 - 11:35 AM

Thanks for the patch. I'll look into this as soon as I can and have it merged with the SDK.

Regards,
Andreas
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#7 Andreas Jonsson   Moderators   

4553
Like
0Likes
Like

Posted 22 February 2013 - 07:51 PM

I received another patch from ketmar that added support for binary numbers in addition to octal. I've checked in that in revision 1571.

 

The nice thing about that patch is the consistency with the prefixes, example:

 

int binary = 0b11111111;
int octal = 0o7777;
int decimal = 0d999999;
int hexadecimal = 0xFFFFFFFF;

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.