<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<div>wrt <a href="https://github.com/mono/mono/commit/fb91fce5d339bb9ffe507588f5bc1d8d6f244d9b" class="OWAAutoLink" id="LPlnk3844" previewremoved="true">https://github.com/mono/mono/commit/fb91fce5d339bb9ffe507588f5bc1d8d6f244d9b</a><br>
<br>
</div>
<div><br>
</div>
<div>This doesn't seem right to me.</div>
<div>Both of these should have the and 0xff.</div>
<div><br>
</div>
<div>$ cat /s/1.c</div>
<div>unsigned char f1 (double i)</div>
<div>{</div>
<div>        return (unsigned char)i;</div>
<div>}</div>
<div><br>
</div>
<div>unsigned char f2 (double i)</div>
<div>{</div>
<div>        return (unsigned char)(int)i;</div>
<div>}</div>
<div><br>
</div>
<div>$ clang --version</div>
<div><br>
</div>
<div>Apple LLVM version 9.0.0 (clang-900.0.39.2)</div>
<div>Target: x86_64-apple-darwin16.7.0</div>
<div>Thread model: posix</div>
<div>InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin</div>
<div><br>
</div>
<div>$ clang -arch arm64 -O2 -S -c /s/1.c && more 1.s</div>
<div><span style="font-size: 12pt;"><br>
</span></div>
<div><span style="font-size: 12pt;">_f1:   </span><br>
</div>
<div><span style="font-size: 12pt;">        fcvtzs  w0, d0</span><br>
</div>
<div>        ret</div>
<div><br>
</div>
<div><span style="font-size: 12pt;">_f2:   </span></div>
<div><span style="font-size: 12pt;">        fcvtzs  w8, d0</span><br>
</div>
<div>        and     w0, w8, #0xff</div>
<div>        ret</div>
<div><br>
</div>
</div>
</body>
</html>