Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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 pondering the Monastery: (8)
As of 2015-07-03 08:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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









    Results (50 votes), past polls