To protect your data, the CISO officer has suggested users to enable GitLab 2FA as soon as possible.

Commit e8c1c53e authored by John Zhang's avatar John Zhang
Browse files

Revert "attempts to resolve 32-bit uint and float bit casting (still not resolved)"

This reverts commit 82ed558f.
parent 82ed558f
......@@ -54,21 +54,9 @@ ZEROF = getfloatstorage(0.0)
# ____________________________________________________________
def int2singlefloat(x):
from rpython.rlib.objectmodel import fetch_translated_config
from rpython.rtyper.lltypesystem import lloperation as llop
config = fetch_translated_config()
if config and config.translation.backend == "mu": # translated
return llop.convert_uint_bytes_to_single_float(x)
x = rffi.r_uint(x)
return longlong2float.uint2singlefloat(x)
def singlefloat2int(x):
from rpython.rlib.objectmodel import fetch_translated_config
from rpython.rtyper.lltypesystem import lloperation as llop
config = fetch_translated_config()
if config and config.translation.backend == "mu": # translated
x = llop.convert_single_float_bytes_to_uint(x)
else:
x = longlong2float.singlefloat2uint(x)
x = longlong2float.singlefloat2uint(x)
return rffi.cast(lltype.Signed, x)
......@@ -725,8 +725,6 @@ __spec_cast_map = {
('truncate', 'longlong', 'int'): 'TRUNC',
('convert', 'float_bytes', 'longlong'): 'BITCAST',
('convert', 'longlong_bytes', 'float'): 'BITCAST',
('convert', 'single_float_bytes', 'uint'): 'BITCAST',
('convert', 'uint_bytes', 'single_float'): 'BITCAST'
}
for triplet in __spec_cast_map:
......
......@@ -651,17 +651,9 @@ def byteswap(arg):
from rpython.rlib.longlong2float import longlong2float, float2longlong,\
uint2singlefloat, singlefloat2uint
from rpython.rlib.objectmodel import fetch_translated_config
from rpython.rtyper.lltypesystem import lloperation as llop
config = fetch_translated_config()
_MU = config and config.translation.backend == "mu"
T = lltype.typeOf(arg)
if T == lltype.SingleFloat:
if _MU:
arg = llop.convert_single_float_bytes_to_uint(arg)
else:
arg = singlefloat2uint(arg)
arg = singlefloat2uint(arg)
elif T == lltype.Float:
arg = float2longlong(arg)
elif T == lltype.LongFloat:
......@@ -694,10 +686,7 @@ def byteswap(arg):
assert False # unreachable code
if T == lltype.SingleFloat:
if _MU:
return llop.convert_uint_bytes_to_single_float(rffi.cast(rffi.UINT, res))
else:
return uint2singlefloat(rffi.cast(rffi.UINT, res))
return uint2singlefloat(rffi.cast(rffi.UINT, res))
if T == lltype.Float:
return longlong2float(rffi.cast(rffi.LONGLONG, res))
return rffi.cast(T, res)
......
......@@ -364,8 +364,6 @@ LL_OPERATIONS = {
'force_cast': LLOp(sideeffects=False), # only for rffi.cast()
'convert_float_bytes_to_longlong': LLOp(canfold=True),
'convert_longlong_bytes_to_float': LLOp(canfold=True),
'convert_single_float_bytes_to_uint': LLOp(canfold=True),
'convert_uint_bytes_to_single_float': LLOp(canfold=True),
'likely': LLOp(canfold=True),
'unlikely': LLOp(canfold=True),
......
......@@ -9,7 +9,7 @@ RPYC_DIR = ../../c
RPYC_SRC_DIR = $(RPYC_DIR)/src
PYPY_MOD_DIR = ../../../../pypy/module
CC = cc
OBJS = dtoa.o utils.o errno.o tscmp.o linux_debug.o fakestack.o signals.o
OBJS = dtoa.o utils.o errno.o tscmp.o linux_debug.o fakestack.o
FLAGS = -D__MU__
dtoa.o: $(RPYC_SRC_DIR)/dtoa.c $(RPYC_SRC_DIR)/dtoa.h
......@@ -30,12 +30,12 @@ linux_debug.o: src/linux_debug.c
fakestack.o: src/fakestack.c
$(CC) -fPIC $(FLAGS) -c -o $@ $<
signals.o: $(RPYC_SRC_DIR)/signals.c $(RPYC_SRC_DIR)/signals.h
$(CC) -fPIC $(FLAGS) -c -I $(RPYC_DIR) -o $@ $<
librpyc.so: $(OBJS)
$(CC) -shared -o $@ $(OBJS)
rm $(OBJS)
clean:
rm librpyc.so
# vim: ts=8 sw=8 sts=0 noet ai
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment