From 6b942e5092eb83564ec5d691680dcda0859cb240 Mon Sep 17 00:00:00 2001 From: Naren Dasan Date: Fri, 22 Jan 2021 15:46:22 -0800 Subject: [PATCH] fix(//py): Fix bounds for enum macros Signed-off-by: Naren Dasan Signed-off-by: Naren Dasan --- py/trtorch/csrc/tensorrt_classes.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/py/trtorch/csrc/tensorrt_classes.h b/py/trtorch/csrc/tensorrt_classes.h index 3b8b3cdcdb..1ad32b3167 100644 --- a/py/trtorch/csrc/tensorrt_classes.h +++ b/py/trtorch/csrc/tensorrt_classes.h @@ -18,13 +18,13 @@ namespace pyapi { } // TODO: Make this error message more informative -#define ADD_ENUM_GET_SET(field_name, type, max_val) \ - void set_##field_name(int64_t val) { \ - TRTORCH_CHECK(val < max_val, "Invalid enum value for field"); \ - field_name = static_cast(val); \ - } \ - int64_t get_##field_name() { \ - return static_cast(field_name); \ +#define ADD_ENUM_GET_SET(field_name, type, max_val) \ + void set_##field_name(int64_t val) { \ + TRTORCH_CHECK(val >= 0 && val <= max_val, "Invalid enum value for field"); \ + field_name = static_cast(val); \ + } \ + int64_t get_##field_name() { \ + return static_cast(field_name); \ } struct InputRange : torch::CustomClassHolder {