fix C++ non-const narrowing errors on LP64-clang archs other than amd64; ok jca@

This commit is contained in:
naddy 2018-07-10 13:53:29 +00:00
parent 730a96df0c
commit f6c1d6ad8c
2 changed files with 20 additions and 1 deletions

View File

@ -1,10 +1,11 @@
# $OpenBSD: Makefile,v 1.16 2017/11/30 03:32:32 kirby Exp $
# $OpenBSD: Makefile,v 1.17 2018/07/10 13:53:29 naddy Exp $
COMMENT = Enhanced Duke Nukem 3D engine
RDATE = 20171105
RTAG = 6496
DISTNAME = eduke32_src_${RDATE}-${RTAG}
PKGNAME = eduke32-2.0.0.${RTAG}
REVISION = 0
EXTRACT_SUFX = .tar.xz
CATEGORIES = games x11

View File

@ -0,0 +1,18 @@
$OpenBSD: patch-source_build_include_compat_h,v 1.1 2018/07/10 13:53:29 naddy Exp $
Cast to int32_t to match the return type of the SSE2-optimized function
on amd64. This fixes errors on other LP64-clang archs:
non-constant-expression cannot be narrowed from type 'long' to 'int32_t'
Index: source/build/include/compat.h
--- source/build/include/compat.h.orig
+++ source/build/include/compat.h
@@ -606,7 +606,7 @@ static FORCE_INLINE int32_t Blrintf(const float x)
return n;
}
#else
-#define Blrintf lrintf
+#define Blrintf(x) static_cast<int32_t>(lrintf(x))
#endif
#if defined(__arm__)