diff --git a/src/fpy/macros.py b/src/fpy/macros.py index a2acd6d0..2edfc8ba 100644 --- a/src/fpy/macros.py +++ b/src/fpy/macros.py @@ -43,13 +43,9 @@ ) from fpy.bytecode.directives import ( FloatDivideDirective, - FloatSubtractDirective, - FloatToUnsignedIntDirective, FloatAbsDirective, IntAbsDirective, - IntegerTruncate64To32Directive, IntegerZeroExtend32To64Directive, - PeekDirective, PushTimeDirective, PushValDirective, FloatLogDirective, @@ -153,46 +149,6 @@ def generate_sleep_until_llvm(builder, args): ) -def generate_sleep_float( - node: Ast, const_args: dict[int, FpyValue], arg_types: list[FpyType] -) -> list[Directive | Ir]: - # convert F64 to seconds and microseconds - dirs = [ - # first do seconds - # copy the f64 - PushValDirective(FpyValue(StackSizeType, 8).serialize()), - PushValDirective(FpyValue(StackSizeType, 0).serialize()), - PeekDirective(), - # convert to U64 - FloatToUnsignedIntDirective(), - # and then U32 - IntegerTruncate64To32Directive(), - # now we have f64, u32 (seconds) on stack - # now do microseconds - # copy the f64 and u32 - PushValDirective(FpyValue(StackSizeType, 12).serialize()), - PushValDirective(FpyValue(StackSizeType, 0).serialize()), - PeekDirective(), - # turn the u32 into a float - IntegerZeroExtend32To64Directive(), - UnsignedIntToFloatDirective(), - # subtract, this should give us the frac - FloatSubtractDirective(), - # okay now multiply by 1000000 - PushValDirective(FpyValue(F64, 1_000_000.0).serialize()), - # now convert to u32 - FloatToUnsignedIntDirective(), - IntegerTruncate64To32Directive(), - ] - - return dirs - - -MACRO_SLEEP_FLOAT = BuiltinFuncSymbol( - "sleep", NOTHING, [("seconds", F64, None)], generate_sleep_float -) - - def generate_log_signed_int( node: Ast, const_args: dict[int, FpyValue], arg_types: list[FpyType] ) -> list[Directive | Ir]: