Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Bitwise Operator Error

by XooR (Beadle)
on Oct 02, 2008 at 19:29 UTC ( #715078=note: print w/ replies, xml ) Need Help??

in reply to Bitwise Operator Error

I reimplemented your example with BigInt. I hope that this you wanted:

#!/usr/bin/perl # File use warnings; use strict; use Math::BigInt; my $testString = " 00008008 000000FF 00800000"; print "Original: $testString\n"; $testString =~ s/\s//g; $testString =~ s/^/0x/g; my $big_x = new Math::BigInt($testString); my $big_y = new Math::BigInt("40000000_00000000_00000000"); my $big_result = $big_x->band( $big_y ); print $big_x->as_hex(), " & ", $big_y->as_hex(), "\n"; print "Mask Result: ", $big_result->as_hex(), "\n";

Comment on Re: Bitwise Operator Error
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://715078]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2015-07-30 08:23 GMT
Find Nodes?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...

    Results (270 votes), past polls