浏览代码

Do not limit bounds of numeric values before casting them

Ole Krüger 10 年之前
父节点
当前提交
d84b5cc1db
共有 1 个文件被更改,包括 1 次插入7 次删除
  1. 1 7
      lib/luwra/types.hpp

+ 1 - 7
lib/luwra/types.hpp

@@ -142,13 +142,7 @@ namespace internal {
 		static inline
 		I read(State* state, int index) {
 			return
-				std::max<B>(
-					std::numeric_limits<I>::lowest(),
-					std::min<B>(
-						std::numeric_limits<I>::max(),
-						NumericTransportValue<B>::read(state, index)
-					)
-				);
+				static_cast<I>(NumericTransportValue<B>::read(state, index));
 		}
 
 		static inline