瀏覽代碼

mcf's improved rsval()

It is semantically the same but
does not rely on implementation-
defined behavior.
Quentin Carbonneaux 1 年之前
父節點
當前提交
a2ad38086c
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      all.h

+ 1 - 1
all.h

@@ -115,7 +115,7 @@ static inline int rtype(Ref r)
 
 static inline int rsval(Ref r)
 {
-	return (int32_t)((int64_t)r.val << 3) >> 3;
+	return ((int)r.val ^ 0x10000000) - 0x10000000;
 }
 
 enum CmpI {