From 1411a10fcf1bc0986fe57bb23144904b67941a4f Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 22 Oct 2021 15:01:16 +0100 Subject: [PATCH] in SimdScope only update module AST Typecast function in SIMD mode do not whatever you do change the mode over to Simd casting in Scalar mode --- src/ieee754/part/simd_scope.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ieee754/part/simd_scope.py b/src/ieee754/part/simd_scope.py index da17af18..ca134918 100644 --- a/src/ieee754/part/simd_scope.py +++ b/src/ieee754/part/simd_scope.py @@ -79,12 +79,13 @@ class SimdScope: def __init__(self, *, module, elwid=None, vec_el_counts=None, elwid_type=IntElWid, scalar=False): - # must establish module as part of context and inform + # in SIMD mode, must establish module as part of context and inform # the module to operate under "SIMD" Type 1 (AST) casting rules, # not the # default "Value.cast" rules. - self.module = module - from ieee754.part.partsig import SimdSignal - module._setAstTypeCastFn(SimdSignal.cast) + if not scalar: + self.module = module + from ieee754.part.partsig import SimdSignal + module._setAstTypeCastFn(SimdSignal.cast) if isinstance(elwid, (IntElWid, FpElWid)): elwid_type = type(elwid) -- 2.30.2