Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

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 displayPipeTracer2.pl 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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (17)
As of 2014-08-27 13:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (238 votes), past polls