Mapped files of integers can not be shared directly 
between j32 and j64, because (as you pointed out)
an integer is 4 bytes in j32 but 8 bytes in j64.
You can use the 3!:x verbs to convert between the
two types of integers.  A "limit error" is signalled
on attempting to convert a 8-byte integer to a
4-byte integer which is too large for 4 bytes.
Converting from 4 byte integers to 8 byte integers
will always succeed (space permitting).

The following examples were executed on j32.
The examples use 3!:3 for illustration. In actual
use 3!:1 with a left argument that respects the
byte order of the underlying machine would be 
more efficient.

   ] x=: 5 [EMAIL PROTECTED] 100
63 92 51 92 39
   ] t64=: 2 (3!:3) x
e200000000000000
0000000000000004
0000000000000005
0000000000000001
0000000000000005
000000000000003f
000000000000005c
0000000000000033
000000000000005c
0000000000000027
   3!:2 t64
63 92 51 92 39
   ] t64a=: 'f' (<8;0)}t64
e200000000000000
0000000000000004
0000000000000005
0000000000000001
0000000000000005
000000000000003f
000000000000005c
0000000000000033
f00000000000005c
0000000000000027
   3!:2 t64a
|limit error
|       3!:2 t64a



----- Original Message -----
From: Anssi Seppälä <[EMAIL PROTECTED]>
Date: Tuesday, August 7, 2007 23:19
Subject: [Jprogramming] Sharing mapped file between 64bit and 32bit J
To: Programming forum <[email protected]>

> I am studying methods to share data between 32 and 64 bit J. The 
> jfiles seem to work fine, but mapped files are different because 
> the 
> intergers are 4 and 8 bytes. I wonder it is possible to  
> convert in a 
> 64 bit J integers to 32 bit representation and write to a mapped 
> file 
> and vice versa. I wonder if this reasonable idea and how the 
> conversion is best to do?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to