On 2020-01-02 10:14, Tobias Boege wrote:
On Thu, 02 Jan 2020, ToddAndMargo via perl6-users wrote:
Hi All,
βHe who asks is a fool for five minutes, but he who
does not ask remains a fool forever.β
β Mark Twain
This would be my five minutes. I will live.
How do I do a 32 bit unsigned integer (cardinal)? I
have a situation where I need to be able to have the
first bit be a one and not have Raku think it is
a negative number.
It's called uint32:
https://docs.perl6.org/language/nativetypes#index-entry-uint32
Hi Tobias,
Perfect! Thank you!
-T
p6 'my uint16 $x = 0x8765;
my int16 $y = 0x8765;
say $x.base(0x10);
say $y.base(0x10);'
8765
-789B
p6 'my uint16 $x = 0x8765;
$x += 0xFF;
say $x.base(0x10);'
8864
p6 'my uint16 $x = 0x8765;
my int16 $y = $x +| 0x00;
say $x.base(0x10); say $y.base(0x10);'
8765
-789B
p6 'my uint16 $x = 0x4ABC;
$x = $x +< 1;
say $x.base(0x10);'
9578
p6 'my uint16 $x = 0x4ABC;
$x += $x;
say $x.base(0x10);'
9578