unsigned div

v1
Brett 2024-04-04 09:22:29 -04:00
parent cbb747634a
commit de5d363fe8
2 changed files with 5 additions and 5 deletions

View File

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 3.5)
include(cmake/color.cmake) include(cmake/color.cmake)
set(BLT_VERSION 0.16.1) set(BLT_VERSION 0.16.2)
set(BLT_TEST_VERSION 0.0.1) set(BLT_TEST_VERSION 0.0.1)
set(BLT_TARGET BLT) set(BLT_TARGET BLT)

View File

@ -62,15 +62,15 @@ namespace blt
BLT_ATTRIB_NO_INLINE friend fp64 operator*(fp64 left, fp64 right) BLT_ATTRIB_NO_INLINE friend fp64 operator*(fp64 left, fp64 right)
{ {
auto lhs = static_cast<__int128>(left.v); auto lhs = static_cast<unsigned __int128>(left.v);
auto rhs = static_cast<__int128>(right.v); auto rhs = static_cast<unsigned __int128>(right.v);
return fp64(static_cast<u64>((lhs * rhs) >> 32)); return fp64(static_cast<u64>((lhs * rhs) >> 32));
} }
BLT_ATTRIB_NO_INLINE friend fp64 operator/(fp64 left, fp64 right) BLT_ATTRIB_NO_INLINE friend fp64 operator/(fp64 left, fp64 right)
{ {
auto lhs = static_cast<__int128>(left.v); auto lhs = static_cast<unsigned __int128>(left.v);
auto rhs = static_cast<__int128>(right.v); auto rhs = static_cast<unsigned __int128>(right.v);
return fp64(static_cast<u64>((lhs / rhs) << 32)); return fp64(static_cast<u64>((lhs / rhs) << 32));
} }