Author: Armin Rigo <[email protected]>
Branch:
Changeset: r50135:c8366cfed4c1
Date: 2011-12-04 18:15 +0100
http://bitbucket.org/pypy/pypy/changeset/c8366cfed4c1/
Log: Fix
diff --git a/pypy/rpython/module/ll_os_stat.py
b/pypy/rpython/module/ll_os_stat.py
--- a/pypy/rpython/module/ll_os_stat.py
+++ b/pypy/rpython/module/ll_os_stat.py
@@ -12,6 +12,7 @@
from pypy.rpython.tool import rffi_platform as platform
from pypy.rpython.lltypesystem.rtupletype import TUPLE_TYPE
from pypy.rlib import rposix
+from pypy.rlib.rarithmetic import intmask
from pypy.rlib.objectmodel import specialize
from pypy.translator.tool.cbuild import ExternalCompilationInfo
from pypy.rpython.annlowlevel import hlstr
@@ -442,20 +443,19 @@
# Helper functions for win32
def make_longlong(high, low):
- return (lltype.r_longlong(high) << 32) + lltype.r_longlong(low)
+ return (rffi.r_longlong(high) << 32) + rffi.r_longlong(low)
# Seconds between 1.1.1601 and 1.1.1970
-secs_between_epochs = lltype.r_longlong(11644473600)
+secs_between_epochs = rffi.r_longlong(11644473600)
def FILE_TIME_to_time_t_nsec(filetime):
ft = make_longlong(filetime.c_dwHighDateTime, filetime.c_dwLowDateTime)
# FILETIME is in units of 100 nsec
nsec = (ft % 10000000) * 100
time = (ft / 10000000) - secs_between_epochs
- return time, nsec
+ return intmask(time), intmask(nsec)
def time_t_to_FILE_TIME(time, filetime):
- ft = lltype.r_longlong((time + secs_between_epochs) * 10000000)
- filetime.c_dwHighDateTime = lltype.r_uint(ft >> 32)
- filetime.c_dwLowDateTime = lltype.r_uint(ft & lltype.r_uint(-1))
-
+ ft = (rffi.r_longlong(time) + secs_between_epochs) * 10000000
+ filetime.c_dwHighDateTime = rffi.r_uint(ft >> 32)
+ filetime.c_dwLowDateTime = rffi.r_uint(ft) # masking off high bits
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit