From 1b9ac6e7aee3cf63495a65c2d7dbf79a0be23d7d Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sun, 27 Oct 2019 22:09:27 +0100 Subject: Verify precision parameter --- boltzgen/kernel/target/precision.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/boltzgen/kernel/target/precision.py b/boltzgen/kernel/target/precision.py index 45f84cf..d22e922 100644 --- a/boltzgen/kernel/target/precision.py +++ b/boltzgen/kernel/target/precision.py @@ -1,15 +1,16 @@ -class cpp: +class common: @classmethod def get_float_type(self, precision): - return { - 'single': 'float', - 'double': 'double' - }.get(precision) + if precision not in ['single', 'double']: + raise Exception("Precision must be either 'single' or 'double'") -class cl: - @classmethod - def get_float_type(self, precision): return { 'single': 'float', 'double': 'double' }.get(precision) + +class cpp(common): + pass + +class cl(common): + pass -- cgit v1.2.3