Re: bitwise NOT

2020-01-15 Thread Tom Browder
guys, interesting thread, but it's "complement" -Tom

Re: bitwise NOT

2020-01-14 Thread Todd Chester via perl6-users
On Tue, Jan 14, 2020 at 7:45 AM Paul Procacci > wrote: >> What is the syntax for a twos complement anyway? I'm not sure I understand the question. Two's compliment is +^ ... the routine you've been using. On Tue, Jan 14, 2020 at 12:33 AM ToddAndMargo

Re: bitwise NOT

2020-01-14 Thread Gerard ONeill
A negative number (-A5) is the twos compliment of the positive number. A ones compliment is all the bits flipped. A twos compliment is a ones compliment plus one. So a ones compliment of (A5) is (-A5 - 1), which is -A6. So presumably, the twos compliment operator is (-). And I suppose for consi

Re: bitwise NOT

2020-01-14 Thread Paul Procacci
>> What is the syntax for a twos complement anyway? I'm not sure I understand the question. Two's compliment is +^ ... the routine you've been using. On Tue, Jan 14, 2020 at 12:33 AM ToddAndMargo via perl6-users < perl6-us...@perl.org> wrote: > >> On Mon, Jan 13, 2020 at 11:30 PM ToddAndMargo v

Re: bitwise NOT

2020-01-13 Thread ToddAndMargo via perl6-users
On Mon, Jan 13, 2020 at 11:30 PM ToddAndMargo via perl6-users mailto:perl6-us...@perl.org>> wrote: Hi All, This works, $ p6 'my uint8 $c = 0xA5; my uint8 $d = +^$c; say $d.base(16);' 5A But this does not: $ p6 'my uint8 $c = 0xA5; say (+^$c).base(16);'

Re: bitwise NOT

2020-01-13 Thread Paul Procacci
If you read the signature for +^, you'll notice it returns an Int. In your first working example, you're taking a uint8 with binary value 10100101, zero extending it to 64 bits via +^, applying a two's compliment, and then assigning bits [0:7] to another uint8 which at that point contains the bin

bitwise NOT

2020-01-13 Thread ToddAndMargo via perl6-users
Hi All, This works, $ p6 'my uint8 $c = 0xA5; my uint8 $d = +^$c; say $d.base(16);' 5A But this does not: $ p6 'my uint8 $c = 0xA5; say (+^$c).base(16);' -A6 1) who turned it into an negative integer? 2) how do I turn it back? Many thanks, -T

Re: [PATCH] add bnots (string bitwise not) ops

2004-03-22 Thread Leopold Toetsch
Goplat <[EMAIL PROTECTED]> wrote: > Parrot seems to be missing the bitwise-not for strings. Attached patch adds a > string_bitwise_not function, bitwise_nots vtable, and "bnots" ops. Thanks, applied. leo

[PATCH] add bnots (string bitwise not) ops

2004-03-22 Thread Goplat
Parrot seems to be missing the bitwise-not for strings. Attached patch adds a string_bitwise_not function, bitwise_nots vtable, and "bnots" ops. __ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/f