Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2009555rdd; Thu, 11 Jan 2024 17:07:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IHupun0Emgy5SERukJlr4xHfxodUtROi2wYbyY26cnXdPzlXu3/XJ544FAx4+9ez31hCLMC X-Received: by 2002:a17:90a:4089:b0:28d:dd2a:6804 with SMTP id l9-20020a17090a408900b0028ddd2a6804mr669454pjg.79.1705021648688; Thu, 11 Jan 2024 17:07:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705021648; cv=none; d=google.com; s=arc-20160816; b=hA1Nk0HInSMg8dme0PRKOyfIHGYJijyYkAnxPma1Q36w8SHqDnww9VEaN1z0mdCnhn qQ2/Qi6ZB7VxwrBZBuQOTWFxVQaOpFCdyXcXc9YYVOSrpU14pY0xia3J7Bi8twFNA3dI MJb3m1xOE01h0IWIsrmEJd8d6TcbRkdgtdloGHX04KAcEOWHDNjVC50J9+zrNY05viyd OOkXlysAYn1cdJCtax9CSn225ER/EI7k22Qo+LKuJvlXV6NcPQ9Tk5dxqhOznKJ+wzth A2KketbKV2ChDInVSHNGFJOtn0u4Z72TCKErH9fpEAJHRldEuK3NirDDpQfbrwyAjXIj AL5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JirkDiOLIcgfiGK4i5BgIE2o8L87QMTz7u6sXd+9BV4=; fh=3wwMOSZHXfF+HhZXL7lJC1yd3JF+O3lAbpBKZgK5/kU=; b=iOD9ZL+PgEHTyo6YvtjFPNOauA3oUKqEw0a0zxj06ciuxb91YA/r8UMoxjJ9zmReuT TbtO4R/g96te4EXzgRHhiO3Jdc9raRdAtYzi+BoXzhH3+wzahLaAUeVuBW7VSjZFjnTy 4/03fOclO0YGWxJUPRtoWxwDqBMbW+3m0lIvgFg702tEDlm4bW1as3q1VR9fcwecCTFP qGxHcjvz+IE7Dxvgc717iqbDq1Qa8H4+VtDfZwz3XrAh8DKyiskO2m8qrwSHpp7ZwS3h H/8unjDZFauwaYNuElvdBHCU9q4j8J4BLLJRcg7db94Nu2+QE6Bd9q7rjAK7SaEZKM8N uIqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=JVaFkVBF; spf=pass (google.com: domain of linux-kernel+bounces-24199-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24199-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id np9-20020a17090b4c4900b0028ada6a6038si2402521pjb.153.2024.01.11.17.07.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 17:07:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-24199-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=JVaFkVBF; spf=pass (google.com: domain of linux-kernel+bounces-24199-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24199-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 87895B24F1D for ; Fri, 12 Jan 2024 01:07:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DF6D817EB; Fri, 12 Jan 2024 01:06:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linux.org.uk header.i=@linux.org.uk header.b="JVaFkVBF" Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [62.89.141.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E7914814 for ; Fri, 12 Jan 2024 01:06:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ftp.linux.org.uk DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description; bh=JirkDiOLIcgfiGK4i5BgIE2o8L87QMTz7u6sXd+9BV4=; b=JVaFkVBF5jTqT/2Cklldtky4u9 iZiPGCxo8jTrdkIsUg1hSrG0hokegysZuJ41/XonuehxCmXIhvAenvVRvvGJkFZqrndwyrJdFr3SS ICJKXxwzj8oRuZzi9XuZdSZ7aU2vaRf0rfJ+uCDzLRXqPHMwtJVTnDokYZLx+R9brSpvOt5MSDA0w d5UTPTJom3lYdw3K2Gahdkq3IthpFYcuvG++gRcnM9pk1zWvFKexIsGVUngPOIQr3fZuBxp7khVKB ZgVVNS/fpBTrhj4Cn7NhnayFERr4l8qc4gYCRq7PcN+Onopre0ZW08joIR6Ivgm3GqAReAglGgrzJ BYSSGqTQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1rO60E-00DVoZ-12; Fri, 12 Jan 2024 01:06:30 +0000 Date: Fri, 12 Jan 2024 01:06:30 +0000 From: Al Viro To: Guilherme =?iso-8859-1?Q?Gi=E1como_Sim=F5es?= Cc: linux-kernel@vger.kernel.org Subject: Re: new library Message-ID: <20240112010630.GZ1674809@ZenIV> References: <5AFF5BF9-BD11-4A60-BD42-7EC516164D41@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5AFF5BF9-BD11-4A60-BD42-7EC516164D41@gmail.com> Sender: Al Viro On Thu, Jan 11, 2024 at 09:48:46PM -0300, Guilherme Gi?como Sim?es wrote: > For ex: 1234 -> "12.34", and i show this in dmesg output: [09876] 12.34 Er... What's wrong with "%d.%0*d", n / 100, 2, n % 100 in sprintf/printk/etc. arguments? It's slightly messier if you want to handle the negatives as well, but also not impossible - "%s%d.%0*d", n < 0 ? "-" : "", abs(n) / 100, 2, abs(n) % 100 will do it, kernel and userland alike. And I'm pretty sure it's going to be cheaper than your solution...