Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Perl Programming Language

Question about pack function in 64bit 2 core CPU


The pack('N',$A) is 4 bytes in 32bit CPU.
But, the result is still 4 bytes in 64bit 2 core CPU?
Have any difference between 64bits and 32bits CPU in ActivePerl?

"sonet" <sonet.@msa.hinet.net> wrote in message

news:f3144i$mjq$1@netnews.hinet.net...

> The pack('N',$A) is 4 bytes in 32bit CPU.
> But, the result is still 4 bytes in 64bit 2 core CPU?
> Have any difference between 64bits and 32bits CPU in ActivePerl?

'N' is for unsigned longs - and an unsigned long is 4 bytes on both 32-bit
and 64-bit builds.

Perhaps you want pack('Q', $A) ?

Cheers,
Rob

Thanks!

    Q   An unsigned quad value.
          (Quads are available only if your system supports 64-bit
           integer values _and_ if Perl has been compiled to support those.
           Causes a fatal error otherwise.)

The parameter Q is just for 64bit cpu.
I have so many code is developer on 32bits cpu.
I just want to know what do i need rewrite the code?

"Sisyphus" <sisyph@nomail.afraid.org>
???????:46541780$0$2869$afc38@news.optusnet.com.au...

Thanks!

    Q   An unsigned quad value.
          (Quads are available only if your system supports 64-bit
           integer values _and_ if Perl has been compiled to support those.
           Causes a fatal error otherwise.)

The parameter Q is just for 64bit cpu.
I have so many code is developer on 32bits cpu.
I just want to know have any code  i need to rewrite!

"Sisyphus" <sisyph@nomail.afraid.org>
???????:46541780$0$2869$afc38@news.optusnet.com.au...

On 2007-05-23 10:29, Sisyphus <sisyph@nomail.afraid.org> wrote:

> "sonet" <sonet.@msa.hinet.net> wrote in message
> news:f3144i$mjq$1@netnews.hinet.net...
>> The pack('N',$A) is 4 bytes in 32bit CPU.
>> But, the result is still 4 bytes in 64bit 2 core CPU?
>> Have any difference between 64bits and 32bits CPU in ActivePerl?

> 'N' is for unsigned longs - and an unsigned long is 4 bytes on both 32-bit
> and 64-bit builds.

This is true only for pack, which defines 'L', 'N', and 'V' to be always
exactly 32 bit, regardless of the size of an 'unsigned long' defined by
the native C compiler (you get the latter with 'L!').

In C an 'unsigned long' is at least 32 bits. On 64-bit systems it is
often (but not always) 64 bits long.

It is better to avoid using the terms 'long' and 'short' for 'N', 'V',
'L', 'l', 'n', 'v', 'S' and 's', to avoid confusion with the C types of
the same name. Call them 32-bit resp. 16 bit values in network, vax, or
native byte order instead.

        hp

--
   _  | Peter J. Holzer    | I know I'd be respectful of a pirate
|_|_) | Sysadmin WSR       | with an emu on his shoulder.
| |   | h@hjp.at         |
__/   | http://www.hjp.at/ |      -- Sam in "Freefall"

"sonet" <sonet.@msa.hinet.net> wrote in message-id:  <f315lg$gl@netnews.hinet.net>

>Thanks!

>    Q   An unsigned quad value.
>          (Quads are available only if your system supports 64-bit
>           integer values _and_ if Perl has been compiled to support those.
>           Causes a fatal error otherwise.)

>The parameter Q is just for 64bit cpu.
>I have so many code is developer on 32bits cpu.
>I just want to know have any code  i need to rewrite!

Anything that uses CRC may need to be inspected again.

"Peter J. Holzer" <hjp-usen@hjp.at> wrote in message
news:slrnf58h9d.rq0.hjp-usenet2@zeno.hjp.at...

> On 2007-05-23 10:29, Sisyphus <sisyph@nomail.afraid.org> wrote:
>> "sonet" <sonet.@msa.hinet.net> wrote in message

.
.
>>> The pack('N',$A) is 4 bytes in 32bit CPU.
>>> But, the result is still 4 bytes in 64bit 2 core CPU?
>>> Have any difference between 64bits and 32bits CPU in ActivePerl?

>> 'N' is for unsigned longs - and an unsigned long is 4 bytes on both
>> 32-bit
>> and 64-bit builds.

.
.

> In C an 'unsigned long' is at least 32 bits. On 64-bit systems it is
> often (but not always) 64 bits long.

Yes - I was referring specifically to ActivePerl, where 'perl -V:longsize'
is '4' on both the 32-bit and 64-bit versions.

However, I'm not entirely sure that's the correct way to look at it. (Please
let me know if my thinking was astray :-)

Cheers,
Rob

On 2007-05-23 16:01, Sisyphus <sisyph@nomail.afraid.org> wrote:

Yes, but my point was that size of 'N' is independent of 'perl
-V:longsize'. Even on systems where the latter is 8, pack('N', ...)
still returns 4 bytes.

        hp

--
   _  | Peter J. Holzer    | I know I'd be respectful of a pirate
|_|_) | Sysadmin WSR       | with an emu on his shoulder.
| |   | h@hjp.at         |
__/   | http://www.hjp.at/ |      -- Sam in "Freefall"

"Peter J. Holzer" <hjp-usen@hjp.at> wrote in message
news:slrnf58to8.sia.hjp-usenet2@zeno.hjp.at...

> On 2007-05-23 16:01, Sisyphus <sisyph@nomail.afraid.org> wrote:

.
.

>> Yes - I was referring specifically to ActivePerl, where
>> 'perl -V:longsize'
>> is '4' on both the 32-bit and 64-bit versions.

> Yes, but my point was that size of 'N' is independent of 'perl
> -V:longsize'. Even on systems where the latter is 8, pack('N', ...)
> still returns 4 bytes.

Aaaah ... I understand (now). Thanks.

Cheers,
Rob

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc