1 /* 2 * Copyright (c) 1997-2018, NVIDIA CORPORATION. All rights reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * 16 */ 17 18 #include "dblint64.h" 19 20 /* 21 * define a C type for long long so that the routines using this type 22 * will always compile. For those systems where long long isn't 23 * supported, TM_I8 will not be defined, but at least the run-time routines 24 * will compile. 25 */ 26 27 #define __HAVE_LONGLONG_T 28 29 #if defined(LINUX8664) || defined(OSX8664) 30 typedef long _LONGLONG_T; 31 typedef unsigned long _ULONGLONG_T; 32 #else 33 typedef long long _LONGLONG_T; 34 typedef unsigned long long _ULONGLONG_T; 35 #endif 36 37 #define I64_MSH(t) t[1] 38 #define I64_LSH(t) t[0] 39 40 int __ftn_32in64_; 41 42 #define VOID void 43 44 typedef union { 45 DBLINT64 i; 46 double d; 47 _LONGLONG_T lv; 48 } INT64D; 49 50 #if defined(LINUX8664) || defined(OSX8664) 51 #define __I8RET_T long 52 #define UTL_I_I64RET(m, l) \ 53 { \ 54 INT64D int64d; \ 55 I64_MSH(int64d.i) = m; \ 56 I64_LSH(int64d.i) = l; \ 57 return int64d.lv; \ 58 } 59 #elif defined(WIN64) 60 /* Someday, should only care if TM_I8 is defined */ 61 #define __I8RET_T long long 62 #define UTL_I_I64RET(m, l) \ 63 { \ 64 INT64D int64d; \ 65 I64_MSH(int64d.i) = m; \ 66 I64_LSH(int64d.i) = l; \ 67 return int64d.lv; \ 68 } 69 #else 70 #define __I8RET_T void 71 #define UTL_I_I64RET __utl_i_i64ret 72 extern VOID UTL_I_I64RET(); 73 #endif 74