diff options
author | Elliott Hughes <enh@google.com> | 2010-05-14 18:13:29 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2010-05-14 18:21:00 -0700 |
commit | f554229f9293b078b77205f37e679105115a7056 (patch) | |
tree | c321e78cc98942bba489692024414857ac41615f /luni/src/main/native | |
parent | 4ccac1d702ac77c52819918af42a215040bc2db1 (diff) | |
download | libcore-f554229f9293b078b77205f37e679105115a7056.zip libcore-f554229f9293b078b77205f37e679105115a7056.tar.gz libcore-f554229f9293b078b77205f37e679105115a7056.tar.bz2 |
More cleanup of "hycomp.h".
This makes sure we ask the system whether it's big- or little-endian, and
doesn't make assumptions about the sizes of built-in types.
This fixes a regression I introduced last week with the previous cleanup,
affecting the double/string conversions. We still fail some of those tests,
but now we're back to only failing the ones we've always failed...
Change-Id: I343c363b01fc34b32a4d5afbc153bfe4c0161137
Diffstat (limited to 'luni/src/main/native')
-rw-r--r-- | luni/src/main/native/cbigint.cpp | 2 | ||||
-rw-r--r-- | luni/src/main/native/cbigint.h | 1 | ||||
-rw-r--r-- | luni/src/main/native/commonDblParce.cpp | 2 | ||||
-rw-r--r-- | luni/src/main/native/commonDblParce.h | 7 | ||||
-rw-r--r-- | luni/src/main/native/fltconst.h | 26 | ||||
-rw-r--r-- | luni/src/main/native/hycomp.h | 80 | ||||
-rw-r--r-- | luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp | 2 | ||||
-rw-r--r-- | luni/src/main/native/org_apache_harmony_luni_util_NumberConvert.cpp | 4 | ||||
-rw-r--r-- | luni/src/main/native/org_apache_harmony_luni_util_fltparse.cpp | 2 |
9 files changed, 34 insertions, 92 deletions
diff --git a/luni/src/main/native/cbigint.cpp b/luni/src/main/native/cbigint.cpp index 92b2992..7757442 100644 --- a/luni/src/main/native/cbigint.cpp +++ b/luni/src/main/native/cbigint.cpp @@ -18,7 +18,7 @@ #include <string.h> #include "cbigint.h" -#if defined(LINUX) || defined(FREEBSD) || defined(ZOS) || defined(MACOSX) || defined(AIX) +#if defined(__linux__) || defined(FREEBSD) || defined(ZOS) || defined(MACOSX) || defined(AIX) #define USE_LL #endif diff --git a/luni/src/main/native/cbigint.h b/luni/src/main/native/cbigint.h index b149053..1e525cb 100644 --- a/luni/src/main/native/cbigint.h +++ b/luni/src/main/native/cbigint.h @@ -18,7 +18,6 @@ #if !defined(cbigint_h) #define cbigint_h -#include "hycomp.h" #include "fltconst.h" #include "JNIHelp.h" diff --git a/luni/src/main/native/commonDblParce.cpp b/luni/src/main/native/commonDblParce.cpp index a07690e..7603851 100644 --- a/luni/src/main/native/commonDblParce.cpp +++ b/luni/src/main/native/commonDblParce.cpp @@ -23,7 +23,7 @@ /* ************************* Defines ************************* */ -#if defined(LINUX) || defined(FREEBSD) +#if defined(__linux__) || defined(FREEBSD) #define USE_LL #endif diff --git a/luni/src/main/native/commonDblParce.h b/luni/src/main/native/commonDblParce.h index d693910..5812f14 100644 --- a/luni/src/main/native/commonDblParce.h +++ b/luni/src/main/native/commonDblParce.h @@ -1,13 +1,13 @@ -/* +/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -15,7 +15,6 @@ * limitations under the License. */ #include <JNIHelp.h> -/* Header for class org_apache_harmony_text_BidiWrapper */ #if !defined(_Included_commonDblParce) #define _Included_commonDblFltParce diff --git a/luni/src/main/native/fltconst.h b/luni/src/main/native/fltconst.h index d96c5bb..a5ed1c8 100644 --- a/luni/src/main/native/fltconst.h +++ b/luni/src/main/native/fltconst.h @@ -18,7 +18,31 @@ #if !defined(fltconst_h) #define fltconst_h -#include "hycomp.h" +#include <sys/types.h> +#include <sys/param.h> +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define HY_LITTLE_ENDIAN +#elif __BYTE_ORDER == __BIG_ENDIAN +#define HY_BIG_ENDIAN +#endif + +/** + * By default order doubles in the native (that is big/little endian) ordering. + */ +#define HY_PLATFORM_DOUBLE_ORDER + +#include <stdint.h> + +typedef int32_t I_32; +typedef uint32_t U_32; +typedef uint64_t U_64; + +typedef I_32 IDATA; +typedef U_32 UDATA; + +#define U32(x) ((U_32) (x)) +#define I32(x) ((I_32) (x)) +#define U32P(x) ((U_32 *) (x)) /* IEEE floats consist of: sign bit, exponent field, significand field single: 31 = sign bit, 30..23 = exponent (8 bits), 22..0 = significand (23 bits) diff --git a/luni/src/main/native/hycomp.h b/luni/src/main/native/hycomp.h deleted file mode 100644 index 9670f8f..0000000 --- a/luni/src/main/native/hycomp.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#if !defined(hycomp_h) -#define hycomp_h - -#if !defined(LINUX) -#define LINUX 1 -#endif - -/** - * LITTLE_ENDIAN: This is for the intel machines or other - * little endian processors. Defaults to big endian. - * - * ATOMIC_FLOAT_ACCESS: So that float operations will work. - */ - - /** - * By default order doubles in the native (that is big/little endian) ordering. - */ - -#define HY_PLATFORM_DOUBLE_ORDER - -/** - * Define common types: - * <ul> - * <li><code>U_32 / I_32</code> - unsigned/signed 32 bits</li> - * </ul> - */ - -typedef int I_32; -typedef unsigned int U_32; - -/** - * Define platform specific types: - * <ul> - * <li><code>U_64 / I_64</code> - unsigned/signed 64 bits</li> - * </ul> - */ - -#if defined(LINUX) || defined(FREEBSD) || defined(AIX) - -#define DATA_TYPES_DEFINED - - typedef unsigned long long U_64; - typedef long long I_64; - -#endif - -typedef I_32 IDATA; -typedef U_32 UDATA; - -#if !defined(DATA_TYPES_DEFINED) -/* no generic U_64 or I_64 */ - -#ifndef HY_BIG_ENDIAN -#define HY_LITTLE_ENDIAN -#endif - -#endif - -#define U32(x) ((U_32) (x)) -#define I32(x) ((I_32) (x)) -#define U32P(x) ((U_32 *) (x)) - -#endif /* hycomp_h */ diff --git a/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp b/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp index 5761a9d..84d2ea0 100644 --- a/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp +++ b/luni/src/main/native/org_apache_harmony_luni_platform_OSNetworkSystem.cpp @@ -552,7 +552,7 @@ static long toMs(const timeval& tv) { * @return 0 on failure, time value in milliseconds on success. * @deprecated Use @ref time_hires_clock and @ref time_hires_delta * - * technically, this should return I_64 since both timeval.tv_sec and + * technically, this should return uint64_t since both timeval.tv_sec and * timeval.tv_usec are long */ diff --git a/luni/src/main/native/org_apache_harmony_luni_util_NumberConvert.cpp b/luni/src/main/native/org_apache_harmony_luni_util_NumberConvert.cpp index 3ea8bdc..b6586ea 100644 --- a/luni/src/main/native/org_apache_harmony_luni_util_NumberConvert.cpp +++ b/luni/src/main/native/org_apache_harmony_luni_util_NumberConvert.cpp @@ -22,7 +22,7 @@ #include "JNIHelp.h" #include "cbigint.h" -#if defined(LINUX) || defined(FREEBSD) +#if defined(__linux__) || defined(FREEBSD) #define USE_LL #endif @@ -63,7 +63,7 @@ * 1.234123412431233E107 * 1.2341234124312331E107 * 1.2341234124312331E107 - * + * */ JNIEXPORT void JNICALL Java_org_apache_harmony_luni_util_NumberConverter_bigIntDigitGeneratorInstImpl ( diff --git a/luni/src/main/native/org_apache_harmony_luni_util_fltparse.cpp b/luni/src/main/native/org_apache_harmony_luni_util_fltparse.cpp index e7f3c5b..d4d0afd 100644 --- a/luni/src/main/native/org_apache_harmony_luni_util_fltparse.cpp +++ b/luni/src/main/native/org_apache_harmony_luni_util_fltparse.cpp @@ -22,7 +22,7 @@ #include "commonDblParce.h" #include "cbigint.h" -#if defined(LINUX) || defined(FREEBSD) || defined(ZOS) +#if defined(__linux__) || defined(FREEBSD) || defined(ZOS) #define USE_LL #endif |