소스 검색

Fix bug in real::real(int64_t) caused by undefined behaviour.

wip/core-clipp
Sam Hocevar 5 년 전
부모
커밋
f30c17f180
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. +4
    -1
      include/lol/math/real.ipp

+ 4
- 1
include/lol/math/real.ipp 파일 보기

@@ -94,7 +94,10 @@ template<> inline real::Real(float f) { new(this) real((double)f); }

template<> inline real::Real(int64_t i)
{
new(this) real((uint64_t)std::abs(i));
// Use this instead of std::abs() because of undefined behaviour
// with INT64_MIN.
uint64_t abs_i = i < 0 ? -(uint64_t)i : (uint64_t)i;
new(this) real(abs_i);
m_sign = i < 0;
}



불러오는 중...
취소
저장