[pypy-commit] pypy default: (arigo, bivab) implement longlong2float and float2longlong in a way that is more close to the C standard. On ARM/32bit this code was causing a reodering of instructions that filled one of the two words with garbage
bivab
noreply at buildbot.pypy.org
Mon Jun 6 18:07:55 CEST 2011
Author: David Schneider <david.schneider at picle.org>
Branch:
Changeset: r44759:5b55fdc0f4a2
Date: 2011-06-06 18:07 +0200
http://bitbucket.org/pypy/pypy/changeset/5b55fdc0f4a2/
Log: (arigo, bivab) implement longlong2float and float2longlong in a way
that is more close to the C standard. On ARM/32bit this code was
causing a reodering of instructions that filled one of the two words
with garbage
diff --git a/pypy/rlib/longlong2float.py b/pypy/rlib/longlong2float.py
--- a/pypy/rlib/longlong2float.py
+++ b/pypy/rlib/longlong2float.py
@@ -32,12 +32,24 @@
from pypy.translator.tool.cbuild import ExternalCompilationInfo
eci = ExternalCompilationInfo(post_include_bits=["""
static double pypy__longlong2float(long long x) {
+ int i;
+ double dd;
char *p = (char*)&x;
- return *((double*)p);
+ char *d = (char*)ⅆ
+ for(i = 0; i < 8; i++) {
+ d[i] = p[i];
+ }
+ return dd;
}
static long long pypy__float2longlong(double x) {
+ int i;
+ long long ll;
char *p = (char*)&x;
- return *((long long*)p);
+ char *l = (char*)≪
+ for(i = 0; i < 8; i++) {
+ l[i] = p[i];
+ }
+ return ll;
}
"""])
More information about the pypy-commit
mailing list