Skip to content

Commit

Permalink
Merge branch 'UltraStudioLTD-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeroIntensity committed Nov 30, 2022
2 parents 9539625 + 13e66cf commit 4a9b652
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions src/pointers/_cstd.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
_c_library_name = find_library("c") or "libc.so.6"

dll = ctypes.CDLL(_c_library_name)

mdll = dll if platform in ("win32", "cygwin") else ctypes.CDLL(find_library("m") or "libm.so.6")

class tm(ctypes.Structure):
_fields_ = [
Expand Down Expand Up @@ -136,20 +136,20 @@ class lconv(ctypes.Structure):
dll.localeconv.argtypes = ()
dll.localeconv.restype = ctypes.POINTER(lconv)
# double frexp(double x, int* exponent)
dll.frexp.argtypes = (
mdll.frexp.argtypes = (
ctypes.c_double,
ctypes.POINTER(ctypes.c_int),
)
dll.frexp.restype = ctypes.c_double
mdll.frexp.restype = ctypes.c_double
# double ldexp(double x, int exponent)
dll.ldexp.argtypes = (ctypes.c_double, ctypes.c_int)
dll.ldexp.restype = ctypes.c_double
mdll.ldexp.argtypes = (ctypes.c_double, ctypes.c_int)
mdll.ldexp.restype = ctypes.c_double
# double modf(double x, double* integer)
dll.modf.argtypes = (
mdll.modf.argtypes = (
ctypes.c_double,
ctypes.POINTER(ctypes.c_double),
)
dll.modf.restype = ctypes.c_double
mdll.modf.restype = ctypes.c_double
# int raise(int sig)
c_raise.argtypes = (ctypes.c_int,)
c_raise.restype = ctypes.c_int
Expand Down
8 changes: 4 additions & 4 deletions src/pointers/bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from ._cstd import c_malloc as _malloc
from ._cstd import c_raise as ct_raise
from ._cstd import c_realloc as _realloc
from ._cstd import dll
from ._cstd import dll, mdll
from ._utils import get_mapped, get_py
from .base_pointers import BaseCPointer, BasePointer
from .c_pointer import TypedCPointer, VoidPointer
Expand Down Expand Up @@ -505,15 +505,15 @@ def setlocale(category: int, locale: StringLike) -> str:


def frexp(x: float, exponent: TypedPtr[int]) -> int:
return binding_base(dll.frexp, x, exponent)
return binding_base(mdll.frexp, x, exponent)


def ldexp(x: float, exponent: int) -> int:
return binding_base(dll.ldexp, x, exponent)
return binding_base(mdll.ldexp, x, exponent)


def modf(x: float, integer: TypedPtr[float]) -> int:
return binding_base(dll.modf, x, integer)
return binding_base(mdll.modf, x, integer)


def fclose(stream: PointerLike) -> int:
Expand Down

0 comments on commit 4a9b652

Please sign in to comment.