You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2007/02/06 15:32:44 UTC

svn commit: r504156 - in /harmony/enhanced/classlib/trunk/modules: luni/src/main/native/luni/shared/ portlib/src/main/native/include/shared/

Author: hindessm
Date: Tue Feb  6 06:32:44 2007
New Revision: 504156

URL: http://svn.apache.org/viewvc?view=rev&rev=504156
Log:
Adding defines for 64bit and big endian platforms.

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/bigint.c
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/cbigint.c
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltconst.h
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltparse.c
    harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/include/shared/hycomp.h

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/bigint.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/bigint.c?view=diff&rev=504156&r1=504155&r2=504156
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/bigint.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/bigint.c Tue Feb  6 06:32:44 2007
@@ -26,8 +26,14 @@
 			the 5th word in memory is skipped and the 5th word of the number is stored in the 6th memory word
 */
 
+#ifdef HY_LITTLE_ENDIAN
 #define at(i) (i)
 #define copysize(i) (i)
+#else
+#define at(i) ((i)^1)
+#define copysize(i) (((i)+1)&~1)
+#endif
+
 
 #define U64_ADD(addr1, addr2) (*(U_64*)(addr1) += *(U_64*)(addr2))
 #define U64_GREATER(addr1, addr2) (*(U_64*)(addr1) > *(U_64*)(addr2))

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/cbigint.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/cbigint.c?view=diff&rev=504156&r1=504155&r2=504156
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/cbigint.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/cbigint.c Tue Feb  6 06:32:44 2007
@@ -22,7 +22,14 @@
 #define USE_LL
 #endif
 
+#ifdef HY_LITTLE_ENDIAN
 #define at(i) (i)
+#else
+#define at(i) ((i)^1)
+/* the sequence for halfAt is -1, 2, 1, 4, 3, 6, 5, 8... */
+/* and it should correspond to 0, 1, 2, 3, 4, 5, 6, 7... */
+#define halfAt(i) (-((-(i)) ^ 1))
+#endif
 
 #define HIGH_IN_U64(u64) ((u64) >> 32)
 #if defined(USE_LL)

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltconst.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltconst.h?view=diff&rev=504156&r1=504155&r2=504156
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltconst.h (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltconst.h Tue Feb  6 06:32:44 2007
@@ -33,11 +33,29 @@
 #define	MAX_U32_DOUBLE	(ESDOUBLE) (4294967296.0)	/* 2^32 */
 #define	MAX_U32_SINGLE		(ESSINGLE) (4294967296.0)	/* 2^32 */
 #define HY_POS_PI      (ESDOUBLE)(3.141592653589793)
+
+#ifdef HY_LITTLE_ENDIAN
+#ifdef HY_PLATFORM_DOUBLE_ORDER
 #define DOUBLE_LO_OFFSET		0
 #define DOUBLE_HI_OFFSET			1
-
+#else
+#define DOUBLE_LO_OFFSET                1
+#define DOUBLE_HI_OFFSET                0
+#endif
 #define LONG_LO_OFFSET			0
 #define LONG_HI_OFFSET			1
+#else
+#ifdef HY_PLATFORM_DOUBLE_ORDER
+#define DOUBLE_LO_OFFSET                1
+#define DOUBLE_HI_OFFSET                0
+#else
+#define DOUBLE_LO_OFFSET                0
+#define DOUBLE_HI_OFFSET                1
+#endif
+#define LONG_LO_OFFSET                  1
+#define LONG_HI_OFFSET                  0
+#endif
+
 #define RETURN_FINITE				0
 #define RETURN_NAN					1
 #define RETURN_POS_INF			2

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltparse.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltparse.c?view=diff&rev=504156&r1=504155&r2=504156
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltparse.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/fltparse.c Tue Feb  6 06:32:44 2007
@@ -26,7 +26,11 @@
 #define USE_LL
 #endif
 
+#ifdef HY_LITTLE_ENDIAN
 #define LOW_I32_FROM_PTR(ptr64) (*(I_32 *) (ptr64))
+#else
+#define LOW_I32_FROM_PTR(ptr64) (*(((I_32 *) (ptr64)) + 1))
+#endif
 
 #define MAX_ACCURACY_WIDTH 8
 

Modified: harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/include/shared/hycomp.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/include/shared/hycomp.h?view=diff&rev=504156&r1=504155&r2=504156
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/include/shared/hycomp.h (original)
+++ harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/include/shared/hycomp.h Tue Feb  6 06:32:44 2007
@@ -47,8 +47,9 @@
 /* By default order doubles in the native (i.e. big/little endian) ordering. */
 #define HY_PLATFORM_DOUBLE_ORDER
 #if defined(LINUX) || defined(FREEBSD)
+
 /* NOTE: Linux supports different processors -- do not assume 386 */
-#if defined(HYX86_64) || defined(HYIA64)
+#if defined(HYX86_64) || defined(HYIA64) || defined(HYPPC64) || defined(HYS390X)
 #define DATA_TYPES_DEFINED
 typedef unsigned long int UDATA;        /* 64bits */
 typedef unsigned long int U_64;
@@ -63,10 +64,20 @@
 typedef U_32 BOOLEAN;
 #define TOC_UNWRAP_ADDRESS(wrappedPointer) ((void *) (wrappedPointer)[0])
 #define TOC_STORE_TOC(dest,wrappedPointer) (dest = ((UDATA*)wrappedPointer)[1])
+
+#define HY_WORD64
+#endif
+
+#if defined(HYS390X) || defined(HYS390) || defined(HYPPC64) || defined(HYPPC32)
+#define HY_BIG_ENDIAN
 #else
-typedef long long I_64;
-typedef unsigned long long U_64;
+#define HY_LITTLE_ENDIAN
 #endif
+
+#if defined(HYPPC32)
+#define VA_PTR(valist) (&valist[0])
+#endif
+
 typedef double SYS_FLOAT;
 #define HYCONST64(x) x##LL
 #define NO_LVALUE_CASTING
@@ -79,9 +90,11 @@
 /* no priorities on Linux */
 #define HY_PRIORITY_MAP {0,0,0,0,0,0,0,0,0,0,0,0}
 
-#if (defined(LINUXPPC) && !defined(LINUXPPC64))
-#define VA_PTR(valist) (&valist[0])
+#if !defined(DATA_TYPES_DEFINED)
+typedef long long I_64;
+typedef unsigned long long U_64;
 #endif
+
 #endif
 
 #define GLOBAL_DATA(symbol) ((void*)&(symbol))
@@ -90,6 +103,8 @@
 /* Win32 - Windows 3.1 & NT using Win32 */
 #if defined(WIN32)
 
+#define HY_LITTLE_ENDIAN
+
 typedef __int64 I_64;
 typedef unsigned __int64 U_64;
 
@@ -150,6 +165,11 @@
 /* don't typedef BOOLEAN since it's already def'ed on Win32 */
 
 #define BOOLEAN UDATA
+
+#ifndef HY_BIG_ENDIAN
+#define HY_LITTLE_ENDIAN
+#endif
+
 #endif
 
 #if !defined(HYCONST64)