diff --git a/include/libcamera/base/utils.h b/include/libcamera/base/utils.h index 4ae02dc97..734ff81e2 100644 --- a/include/libcamera/base/utils.h +++ b/include/libcamera/base/utils.h @@ -90,6 +90,30 @@ template +inline _hex hex(int8_t value, unsigned int width) +{ + return { static_cast(value), width ? width : 2 }; +} + +template<> +inline _hex hex(uint8_t value, unsigned int width) +{ + return { static_cast(value), width ? width : 2 }; +} + +template<> +inline _hex hex(int16_t value, unsigned int width) +{ + return { static_cast(value), width ? width : 4 }; +} + +template<> +inline _hex hex(uint16_t value, unsigned int width) +{ + return { static_cast(value), width ? width : 4 }; +} + template<> inline _hex hex(int32_t value, unsigned int width) {