A
A. Farber
Hello perl users,
I'm programming a card game were 32 cards are used.
I'd like to represent each of those cards by a bit,
because it makes several things easier for me
(for example I can set a mask for a user,
restricting the cards she can play at some moment)
Unfortunately constants like these:
use constant ALL_CARDS => 0xFFFFFFFFFFFFFFFF; # line 46
use constant ALL_SPADES => 0x1111111111111111
use constant ALL_CLUBS => 0x2222222222222222
use constant ALL_DIAMONDS => 0x4444444444444444
use constant ALL_HEARTS => 0x8888888888888888
give me errors:
Integer overflow in hexadecimal number at Const.pm line 46.
Hexadecimal number > 0xffffffff non-portable at Const.pm line 46.
Does anybody have an advice, how could I handle this best?
I'm using perl 5.8.8 at 32-bit OpenBSD 4.3 (and soon 4.4)
Thank you!
Alex
I'm programming a card game were 32 cards are used.
I'd like to represent each of those cards by a bit,
because it makes several things easier for me
(for example I can set a mask for a user,
restricting the cards she can play at some moment)
Unfortunately constants like these:
use constant ALL_CARDS => 0xFFFFFFFFFFFFFFFF; # line 46
use constant ALL_SPADES => 0x1111111111111111
use constant ALL_CLUBS => 0x2222222222222222
use constant ALL_DIAMONDS => 0x4444444444444444
use constant ALL_HEARTS => 0x8888888888888888
give me errors:
Integer overflow in hexadecimal number at Const.pm line 46.
Hexadecimal number > 0xffffffff non-portable at Const.pm line 46.
Does anybody have an advice, how could I handle this best?
I'm using perl 5.8.8 at 32-bit OpenBSD 4.3 (and soon 4.4)
Thank you!
Alex