Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2250934ybp; Thu, 10 Oct 2019 04:45:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqy2WOvUAs4/qVFD7BYgPB+qUNG9UvkciXcsbeb+fqfcWujuPpzyhIrRkBU3WHNMvARcP+9o X-Received: by 2002:a17:906:ce53:: with SMTP id se19mr7506428ejb.17.1570707931225; Thu, 10 Oct 2019 04:45:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570707931; cv=none; d=google.com; s=arc-20160816; b=Q6io8jYlBM9cAkXkA8vaeKPkdrEp/J2xI5vB06C2ItfpDONrjempAAq7Dm27hknTlc 3a8Xner0+Mvzya/KizSUmPd8QccvGGxjlgYJq3zuLdLmUOmbXydoSysWpJF4kjmKuHVS VCYL77gzqtCK+EFvNXZOx6A2pzcKF+Fiqhh+D63QT76DOZus7+cFb1wNckvdmW8HiAFh PbGxXXF/gKkOY+m/7SKaQhP1CEyWJk60gKm+5Khl/gjI1+HDuK3lPsZRHmvcjKwA1jpG iBKEbqqEhLp0mVQTbMD8OXzDzhilU3tzd3rzDcdX7ENual5Bmv4Knlc/k/WtpTmB3Isp 4cYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=uzxYnoeO9th5PZbje/sBiPsvtuK+49seDd9d1KDUDZQ=; b=zrRqNx52878VVTGZEHMr/b1/uE0LYL2/t3Tr6EyDKdtTJ2v1YQxMnnat4G5Zh7n2hZ NkIAB5OdUVGSAumfjJ8wjBuR40iV9GRNhk2aaMUhJ36Hk9kgC9kKvzOAryFrRYrc7L6z qxNOZFAcsHwy/5qLee/wiW5CjhEmYkQrFNWoIQgPF8KoxJLYOzU/b3jWkUjWcGfhvgUV 3lKm4jeGiPGpdf1dRmKyCsjNyWeBDZOif+zl8LLjgbBy4I9jHXg7bdv20o1mX7UESYZq iJ9MXmKiMPjI9LEHIiHpyTLYs4qXHyCFkPIIMmK2BlmS5s2zpZgFPWk3Io8a/Y6Owmvk Y80w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=SAvCTEZN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x3si3224241eda.285.2019.10.10.04.45.07; Thu, 10 Oct 2019 04:45:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=SAvCTEZN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733090AbfJJLmZ (ORCPT + 99 others); Thu, 10 Oct 2019 07:42:25 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:39704 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726523AbfJJLmZ (ORCPT ); Thu, 10 Oct 2019 07:42:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Sender:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=uzxYnoeO9th5PZbje/sBiPsvtuK+49seDd9d1KDUDZQ=; b=SAvCTEZNTEei01z9glEp+Tphh LuqlgccpL7qGgrBq68NENFcA4+adFSRYIXRgakpUqcYgkTHMw0QtxS56GU2Z9gT46L5bLw+heygUg aYEilXemSkBRnNwGEiHGC6PtSxIQO9WTch+6MzsCe2g97MwD5dTRCYaidFD6vId7NRcJqpK8NBC0c 2VY8KhdqxW7TTbcxBXlz2QSIdM7QjWON98/kP2+mqtWMuBTknhbGt9BVJyjXS/0lQjKgygAUufs3M g2ReWFjeDyFkX7BH8ECPrA2zfpqdMCpVw5VeJPaTjQBvVC+sSHoikI40lPGWQjqwOlkpE4K18s7qu et5M5t9Rw==; Received: from 177.205.100.4.dynamic.adsl.gvt.net.br ([177.205.100.4] helo=coco.lan) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iIWps-0004ks-Bv; Thu, 10 Oct 2019 11:42:24 +0000 Date: Thu, 10 Oct 2019 08:42:20 -0300 From: Mauro Carvalho Chehab To: Gon Solo Cc: Linux Media Mailing List , JP , crope@iki.fi, Sean Young , Linux Kernel Subject: Re: [PATCH 1/4] media: si2168: use bits instead of bool for flags Message-ID: <20191010084220.1fa8e1fc@coco.lan> In-Reply-To: <20191010083423.3fff672f@coco.lan> References: <20191004090855.14e418ed@coco.lan> <2942b7ca9ecf86b6bff75c10ccfca25c173c3f0d.1570194906.git.mchehab+samsung@kernel.org> <20191010105544.GA6507@Limone> <20191010083423.3fff672f@coco.lan> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, 10 Oct 2019 08:34:23 -0300 Mauro Carvalho Chehab escreveu: > Em Thu, 10 Oct 2019 12:55:44 +0200 > Gon Solo escreveu: > > > On Fri, Oct 04, 2019 at 10:15:22AM -0300, Mauro Carvalho Chehab wrote: > > > Using bool on struct is not recommended, as it wastes lots of > > > space. So, instead, let's use bits. > > > > Wouldn't "bool b:1;" even be better? I performed a little test: > > Result: > > > > bit_uints: 4 > > bit_bools: 1 > > I know with different types within the struct it looks different, but > > still. > > No. In practice, the compiler will add 3 bytes of pad after bit_bools > (on 32-bit archs), due to performance reasons. Btw, if you want to test, just add something after the bits, and you'll see that it will now report the PAD bytes too: struct bit_uints { unsigned int a0:1; unsigned int a1:1; unsigned int a2:1; unsigned int a3:1; unsigned int a4:1; unsigned int a5:1; unsigned int a6:1; unsigned int a7:1; int i; }; struct bit_bools { bool a0:1; bool a1:1; bool a2:1; bool a3:1; bool a4:1; bool a5:1; bool a6:1; bool a7:1; int i; }; bit_uints: 8 bit_bools: 8 Thanks, Mauro