[{"id":30286,"web_url":"https://patchwork.libcamera.org/comment/30286/","msgid":"<a79213ca-445c-4e8e-87e0-c379647aef59@ideasonboard.com>","date":"2024-07-04T03:56:59","subject":"Re: [PATCH] libcamera: base: utils: Implement hex() for 8-bit and\n\t16-bit values","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Laurent,\n\nThank you for the patch.\n\nOn 04/07/24 12:59 am, Laurent Pinchart wrote:\n> The utils::hex() function is implemented for 32-bit and 64-bit integers,\n> but not for 8-bit and 16-bit. This causes a link error (possibly at\n> runtime for IPA modules due to lazy linking) when trying to print 8-bit\n> or 16-bit integers. Implement additional specializations to fix it.\n>\n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\ntest/utils.cpp can be expanded to cover these as well as part of the patch ?\n\nWith that,\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n> ---\n>   include/libcamera/base/utils.h | 24 ++++++++++++++++++++++++\n>   1 file changed, 24 insertions(+)\n>\n> diff --git a/include/libcamera/base/utils.h b/include/libcamera/base/utils.h\n> index 4ae02dc97478..734ff81e2860 100644\n> --- a/include/libcamera/base/utils.h\n> +++ b/include/libcamera/base/utils.h\n> @@ -90,6 +90,30 @@ template<typename T,\n>   _hex hex(T value, unsigned int width = 0);\n>   \n>   #ifndef __DOXYGEN__\n> +template<>\n> +inline _hex hex<int8_t>(int8_t value, unsigned int width)\n> +{\n> +\treturn { static_cast<uint64_t>(value), width ? width : 2 };\n> +}\n> +\n> +template<>\n> +inline _hex hex<uint8_t>(uint8_t value, unsigned int width)\n> +{\n> +\treturn { static_cast<uint64_t>(value), width ? width : 2 };\n> +}\n> +\n> +template<>\n> +inline _hex hex<int16_t>(int16_t value, unsigned int width)\n> +{\n> +\treturn { static_cast<uint64_t>(value), width ? width : 4 };\n> +}\n> +\n> +template<>\n> +inline _hex hex<uint16_t>(uint16_t value, unsigned int width)\n> +{\n> +\treturn { static_cast<uint64_t>(value), width ? width : 4 };\n> +}\n> +\n>   template<>\n>   inline _hex hex<int32_t>(int32_t value, unsigned int width)\n>   {\n>\n> base-commit: 196abb8d1d6e0fe9d190315e72a85eb12d16a554","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 15E42BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  4 Jul 2024 03:57:06 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D6B0162E22;\n\tThu,  4 Jul 2024 05:57:04 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 17B63619C3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  4 Jul 2024 05:57:04 +0200 (CEST)","from [IPV6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f] (unknown\n\t[IPv6:2405:201:2015:f873:55d7:c02e:b2eb:ee3f])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D1805541;\n\tThu,  4 Jul 2024 05:56:34 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"T6kVMzKd\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1720065395;\n\tbh=ojZfVAnKLPAQ314oBcM0DcJylBB8/WB/KDw679hrHpo=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=T6kVMzKd1KRB1BBX9NcLonRu1Z+qNj7PuKPuQ8JtmpmzwsoX7EuZ/T8g742gV/yXW\n\tkrjxKvL7+tB8zNvO6ZuTYlfpxD3G52lRejCvQfFNtY8kf7cwlvolIN/3eSR8M62dKa\n\tZ+FyFPUsUoBQX0lCxOtlPe5vZc70ovgZ1aYQvhsQ=","Message-ID":"<a79213ca-445c-4e8e-87e0-c379647aef59@ideasonboard.com>","Date":"Thu, 4 Jul 2024 09:26:59 +0530","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH] libcamera: base: utils: Implement hex() for 8-bit and\n\t16-bit values","Content-Language":"en-US","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20240703192924.10643-1-laurent.pinchart@ideasonboard.com>","From":"Umang Jain <umang.jain@ideasonboard.com>","In-Reply-To":"<20240703192924.10643-1-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]