Mercurial > octave-nkf
comparison libinterp/corefcn/jit-typeinfo.cc @ 18565:3f2a95a4b98d draft lyh-review
jit compiler: use existing int functions
author | Stefan Mahr <dac922@gmx.de> |
---|---|
date | Sun, 24 Nov 2013 22:46:32 +0100 |
parents | 5a5a67799338 |
children |
comparison
equal
deleted
inserted
replaced
18564:5a5a67799338 | 18565:3f2a95a4b98d |
---|---|
76 #include "ov-uint8.h" | 76 #include "ov-uint8.h" |
77 #include "ov-uint16.h" | 77 #include "ov-uint16.h" |
78 #include "ov-uint32.h" | 78 #include "ov-uint32.h" |
79 #include "ov-uint64.h" | 79 #include "ov-uint64.h" |
80 #include "pager.h" | 80 #include "pager.h" |
81 #include "oct-inttypes.h" | |
81 | 82 |
82 static llvm::LLVMContext& context = llvm::getGlobalContext (); | 83 static llvm::LLVMContext& context = llvm::getGlobalContext (); |
83 | 84 |
84 jit_typeinfo *jit_typeinfo::instance = 0; | 85 jit_typeinfo *jit_typeinfo::instance = 0; |
85 | 86 |
1072 } | 1073 } |
1073 | 1074 |
1074 extern "C" uint64_t | 1075 extern "C" uint64_t |
1075 octave_jit_mul_uint64_uint64 (uint64_t lhs, uint64_t rhs) | 1076 octave_jit_mul_uint64_uint64 (uint64_t lhs, uint64_t rhs) |
1076 { | 1077 { |
1078 #if 1 | |
1079 return octave_int_arith_base<uint64_t,false>::mul(lhs,rhs); | |
1080 #else | |
1077 #ifdef OCTAVE_INT_USE_LONG_DOUBLE | 1081 #ifdef OCTAVE_INT_USE_LONG_DOUBLE |
1078 long double p = static_cast<long double> (lhs) * static_cast<long double> (rhs); | 1082 long double p = static_cast<long double> (lhs) * static_cast<long double> (rhs); |
1079 if (p > static_cast<long double> (std::numeric_limits<uint64_t>::max ())) | 1083 if (p > static_cast<long double> (std::numeric_limits<uint64_t>::max ())) |
1080 { | 1084 { |
1081 return std::numeric_limits<uint64_t>::max (); | 1085 return std::numeric_limits<uint64_t>::max (); |
1087 | 1091 |
1088 uint64_t hi = res >> 64; | 1092 uint64_t hi = res >> 64; |
1089 uint64_t lo = res; | 1093 uint64_t lo = res; |
1090 | 1094 |
1091 return lo | -!!hi; | 1095 return lo | -!!hi; |
1096 #endif | |
1092 #endif | 1097 #endif |
1093 } | 1098 } |
1094 | 1099 |
1095 extern "C" uint64_t | 1100 extern "C" uint64_t |
1096 octave_jit_incr_uint64 (uint64_t val) | 1101 octave_jit_incr_uint64 (uint64_t val) |