[ub] [c++std-ext-14592] Re: Re: Sized integer types and char bits

Ion Gaztañaga igaztanaga at gmail.com
Sat Oct 26 22:31:44 CEST 2013


El 25/10/2013 1:38, Richard Smith escribió:
> On Thu, Oct 24, 2013 at 4:23 PM, <keld at keldix.com
> <mailto:keld at keldix.com>> wrote:
>
>     I used to program some of these beast a while ago.
>     There were C compilers and some UNIX port for them.
>
>
> Did their C compilers expose non-twos-complement integers, or did they
> emulate twos-complement?

In case you missed my previous message:

"According to ClearPath C compiler's manual:

http://public.support.unisys.com/2200/docs/cp14.0/pdf/78310422-011.pdf

//////////////////////////////////
//////////////////////////////////

Integer Type Conversions

UCS C represents an integer in 36-bit ones complement form (or 72-bit 
ones complement form, if the long long type attribute is specified). 
Unless the CONFORMANCE/ TWOSARITH keyword is used, there is no 
representation change when converting a signed int value to unsigned int 
or when converting an unsigned int value to signed int. For more 
information on the CONFORMANCE keyword, see the C Compiler Programming 
Reference Manual Volume 2.

Now if you read the Java documentation:

"Virtual Machine for the Java™ Platform on ClearPath OS 2200 JProcessor 
[http://public.support.unisys.com/2200/docs/cp14.0/pdf/78310430-016.pdf]

//////////////////////////////////
//////////////////////////////////

8.5.  JNI Transition Data Conversions

The Java language explicitly defines its numerical data types to very 
specific formats and sizes:

-  8-bit 2’s complement signed byte
-  16-bit 2’s complement signed short
-  32-bit 2’s complement signed integer
-  64-bit 2’s complement signed long

Unfortunately, the Java data type definitions do not match or blend very 
well with the UCS C data types:

-  9-bit 1’s complement signed char
-  18-bit 1’s complement short
-  36-bit 1’s complement integer and long
-  72-bit 1’s complement long long (signed only)

[...] When Java code calls native C code, the parameters are converted 
from Java format to OS 2200 native format. When native C code calls Java 
methods, the JProcessor JVM converts the parameters from native format 
to Java format. The JProcessor JVM also performs the appropriate 
conversions when the native C code calls JNI functions to get or set 
object data items or arrays."

Best,

Ion


More information about the ub mailing list