00001 // -*-Mode: C++;-*- 00002 // $Header: /Volumes/cvsrep/developer/OpenADFortTk/src/include/quad.h,v 1.2 2005/06/14 16:55:34 eraxxon Exp $ 00003 00004 // * BeginCopyright ********************************************************* 00005 // *********************************************************** EndCopyright * 00006 00007 //*************************************************************************** 00008 // 00009 // File: 00010 // $Source: /Volumes/cvsrep/developer/OpenADFortTk/src/include/quad.h,v $ 00011 // 00012 // Purpose: 00013 // [The purpose of this file] 00014 // 00015 // Description: 00016 // [The set of functions, macros, etc. defined in the file] 00017 // 00018 //*************************************************************************** 00019 00020 #ifndef FortTk_quad_INCLUDED 00021 #define FortTk_quad_INCLUDED 00022 00023 //************************* System Include Files **************************** 00024 00025 //*************************** User Include Files **************************** 00026 00027 //************************** Open64 Include Files *************************** 00028 00029 #include <../../common/com/targ_const.h> // QUAD_TYPE 00030 00031 //*************************** User Include Files **************************** 00032 00033 //************************** Forward Declarations *************************** 00034 00035 namespace FortTk { 00036 00037 // Used to translate the bits within TCONs. We can safely assume 64 00038 // bit values are available on modern platforms. This is used 00039 // simply to convey bits, so we are not concerned with little/big 00040 // endian issues. 00041 struct uint128_t { 00042 00043 uint128_t() : hi(0), lo(0) { } 00044 ~uint128_t() { } 00045 00046 uint128_t(const uint128_t& v) : hi(v.hi), lo(v.lo) { } 00047 uint128_t(const QUAD_TYPE& v) { *this = v; } 00048 00049 uint64_t hi; 00050 uint64_t lo; 00051 }; 00052 00053 inline uint128_t& 00054 assign(uint128_t& qd1, QUAD_TYPE& qd2) { 00055 qd1.hi = *( ((uint64_t*)&qd2) + 1 ); // high 64 bits 00056 qd1.lo = *( (uint64_t*)&qd2 ); // low 64 bits 00057 return qd1; 00058 } 00059 00060 inline QUAD_TYPE& 00061 assign(QUAD_TYPE& qd1, uint128_t& qd2) { 00062 *( ((uint64_t*)&qd1) + 1 ) = qd2.hi; // high 64 bits 00063 *( (uint64_t*)&qd1 ) = qd2.lo; // low 64 bits 00064 return qd1; 00065 } 00066 00067 }; /* namespace FortTk */ 00068 00069 //*************************************************************************** 00070 00071 #endif
1.5.7.1