{"id":20575,"url":"https://patchwork.libcamera.org/api/patches/20575/?format=json","web_url":"https://patchwork.libcamera.org/patch/20575/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20240704100728.7003-1-laurent.pinchart@ideasonboard.com>","date":"2024-07-04T10:07:27","name":"[v2,1/2] libcamera: base: utils: Implement hex() for 8-bit and 16-bit values","commit_ref":"45bd1f20f6a9c9b97972944358c75beb9dfafb9c","pull_url":null,"state":"accepted","archived":false,"hash":"03ccc2a141ebbeb38506fbbec576c43f3b97adb2","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/20575/mbox/","series":[{"id":4444,"url":"https://patchwork.libcamera.org/api/series/4444/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4444","date":"2024-07-04T10:07:27","name":"[v2,1/2] libcamera: base: utils: Implement hex() for 8-bit and 16-bit values","version":2,"mbox":"https://patchwork.libcamera.org/series/4444/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/20575/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/20575/checks/","tags":{},"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 05A99BD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  4 Jul 2024 10:07:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BC75463331;\n\tThu,  4 Jul 2024 12:07:51 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E456062C99\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  4 Jul 2024 12:07:49 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(117.145-247-81.adsl-dyn.isp.belgacom.be [81.247.145.117])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 32326502\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  4 Jul 2024 12:07:21 +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=\"VT0HL3m5\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1720087641;\n\tbh=8LebbM0aCqbkp6m+2kw82pa2NKtp9xCiQnVo7asxN4g=;\n\th=From:To:Subject:Date:From;\n\tb=VT0HL3m5C236cbedouB+e1/Mrp89gijO5tFyhhqR03XdOe8LoxeIByAmjkIwEQVer\n\tgJSFGTZeYM+oExi3bXBgpRLfDPIoZ9YA/sDVT0gInSX6PXIz7CwuebFNv1cR6/vrbI\n\thk5uHBQj7q9zDO8ezUSRBRC0ir0EpMK4XNKrd1dc=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Subject":"[PATCH v2 1/2] libcamera: base: utils: Implement hex() for 8-bit and\n\t16-bit values","Date":"Thu,  4 Jul 2024 13:07:27 +0300","Message-ID":"<20240704100728.7003-1-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.44.2","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","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>"},"content":"The utils::hex() function is implemented for 32-bit and 64-bit integers,\nbut not for 8-bit and 16-bit. This causes a link error (possibly at\nruntime for IPA modules due to lazy linking) when trying to print 8-bit\nor 16-bit integers. Implement additional specializations to fix it.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n---\n include/libcamera/base/utils.h | 24 ++++++++++++++++++++++++\n 1 file changed, 24 insertions(+)","diff":"diff --git a/include/libcamera/base/utils.h b/include/libcamera/base/utils.h\nindex 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","prefixes":["v2","1/2"]}