Sponsored Content
Top Forums Shell Programming and Scripting How to handle 64 bit arithmetic operation at 32 bit compiled perl interpreter?H Post 302669405 by rrd1986 on Wednesday 11th of July 2012 02:30:34 AM
Old 07-11-2012
How to handle 64 bit arithmetic operation at 32 bit compiled perl interpreter?H

Hi,
Here is the issue. From the program snippet I have Base: 0x1800000000, Size: 0x3FFE7FFFFFFFF which are of 40 and 56 bits. SO I used use bignum to do the math but summing them up I always failed having correct result.

Code:
perl interpreter info,
perl, v5.8.8 built for i386-linux-thread-multi

Program snippet,

Code:
use bignum qw/hex/;

$x ="SAD_MISS_REGION:Base:Size
SAD_MISS_REGION:0x100000000:0x100000000
SAD_MISS_REGION:0x400000000:0x400000000
SAD_MISS_REGION:0x1800000000:0x3FFE7FFFFFFFF";

while ( $x =~ /SAD_MISS_REGION:(.+):(.+)/g ) {

$p = $1; $q = $2;
$phex = hex($1); $qhex = hex($2);

}

print "\n\n\n\nBase: $p, Size: $q \n";
print "\n\n\n\nBaseinDecimal: $phex, SizeinDesimal: $qhex \n";

$z = $phex + $qhex;
print "Z has summed up value:  $z\n";

$zhex = unpack "H*", $z;
#$zhex = uc(sprintf("%x\n", $z));
print "Hexadecimal number of Z: ", $zhex, "\n";

output:

Base: 0x1800000000, Size: 0x3FFE7FFFFFFFF




BaseinDecimal: 103079215104, SizeinDesimal: 1125796827627519
Z has summed up value:  1125899906842623
Hexadecimal number of Z: 31313235383939393036383432363233

------------------------------------------------------------

Math::BigInt seems to be a solution but i dont have it installed at my remote machine. Need a work around. Please help....


Moderator's Comments:
Mod Comment Please use code tags next time for your code and data.

Last edited by zaxxon; 07-11-2012 at 03:34 AM.. Reason: code tags, see PM. Should know that with 18 posts...
 

4 More Discussions You Might Find Interesting

1. Programming

copying or concatinating string from 1st bit, leaving 0th bit

Hello, If i have 2 strings str1 and str2, i would like to copy/concatenate str2 to str1, from 1st bit leaving the 0th bit. How do i do it? (2 Replies)
Discussion started by: jazz
2 Replies

2. Red Hat

can not reboot : PCI: Unable to handle 64-bit address space for

Hello, every one, I tried to install redhat linux enterprise server version 4 (ES4) on the my system with the following configuration Pentium core 2 duo 2.66 E 6750 Intel DG33FB motherboard 160Gb Segate hard disk (SATA) 1024 mb (1GB) DDR2 TRAN RAM Lg DVD/Cd WR BUT AM GETTING... (0 Replies)
Discussion started by: moinkhan31
0 Replies

3. Red Hat

boot the 32 bit kernel on a 64 bit PPC Linux machine?

Hi all, I'm looking to cover a corner case for an upcoming test cycle. Is there a way to boot a RedHat Advanced Server 4 (update 3) installed on a Power PC machine to use a 32 bit kernel? This would be similar to what is done here -> https://www.unix.com/aix/26204-aix-platform.html I've done... (0 Replies)
Discussion started by: philrau
0 Replies

4. Windows & DOS: Issues & Discussions

Which version of Windows Vista to install with a product key? 32-bit or 64-bit?

Hello everyone. I bought a dell laptop (XPS M1330) online which came without a hard drive. There is a Windows Vista Ultimate OEMAct sticker with product key at the bottom case. I checked dell website (here) for this model and it says this model supports both 32 and 64-bit version of Windows... (4 Replies)
Discussion started by: milhan
4 Replies
GAPPLETVIEWER(1)							GNU							  GAPPLETVIEWER(1)

NAME
gappletviewer - Load and runs an applet SYNOPSIS
appletviewer [OPTION]... URL... appletviewer [OPTION]... -code CODE appletviewer [OPTION]... -plugin INPUT,OUTPUT DESCRIPTION
The appletviewer tool loads and runs an applet. Use the first form to test applets specified by tag. The URL should resolve to an HTML document from which the appletviewer will extract applet tags. The APPLET, EMBED and OBJECT tags are supported. If a given document contains multiple applet tags, all the applets will be loaded, with each applet appearing in its own window. Likewise, when multiple URLs are specified, each applet tag instance is given its own window. If a given document contains no recognized tags the appletviewer does nothing. appletviewer http://www.gnu.org/software/classpath/ Use the second form to test an applet in development. This form allows applet tag attributes to be supplied on the command line. Only one applet may be specified using the -code option. The -code option overrides the URL form -- any URLs specified will be ignored. appletviewer -code Test.class -param datafile,data.txt gcjwebplugin uses the third form to communicate with the appletviewer through named pipes. OPTIONS
URL OPTIONS -debug This option is not yet implemented but is provided for compatibility. -encoding CHARSET Use this option to specify an alternate character encoding for the specified HTML page. APPLET TAG OPTIONS -code CODE Use the -code option to specify the value of the applet tag CODE attribute. -codebase CODEBASE Use the -codebase option to specify the value of the applet tag CODEBASE attribute. -archive ARCHIVE Use the -archive option to specify the value of the applet tag ARCHIVE attribute. -width WIDTH Use the -width option to specify the value of the applet tag WIDTH attribute. -height HEIGHT Use the -height option to specify the value of the applet tag HEIGHT attribute. -param NAME,VALUE Use the -param option to specify values for the NAME and VALUE attributes of an applet PARAM tag. PLUGIN OPTION -plugin INPUT,OUTPUT gcjwebplugin uses the -plugin option to specify the named pipe the appletviewer should use for receiving commands (INPUT) and the one it should use for sending commands to gcjwebplugin (OUTPUT). DEBUGGING OPTION -verbose Use the -verbose option to have the appletviewer print debugging messages. STANDARD OPTIONS -help Use the -help option to have the appletviewer print a usage message, then exit. -version Use the -version option to have the appletviewer print its version, then exit. -JOPTION Use the -J option to pass OPTION to the virtual machine that will run the appletviewer. Unlike other options, there must not be a space between the -J and OPTION. BUGS
SEE ALSO
AUTHOR
0.98 2010-07-05 GAPPLETVIEWER(1)
All times are GMT -4. The time now is 03:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy