From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Wood Date: Mon, 21 Jan 2013 12:05:42 -0600 Subject: [U-Boot] [PATCH] Introduce a global bool type In-Reply-To: <20130119103030.3d825efb@lilith> (from albert.u.boot@aribaud.net on Sat Jan 19 03:30:30 2013) Message-ID: <1358791542.31204.0@snotra> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 01/19/2013 03:30:30 AM, Albert ARIBAUD wrote: > /* what I favor */ > clk_is_enabled = ((reg_val >> 9) & 1) ? true: false; > ip_is_enabled = clk_is_enabled && pwd_is_enabled; > if (clk_is_enabled) { ... > > rather than assigning them 'zero/nonzero', or using bitwise ops on > booleans, or testing against boolean constants (although I concede > that the first line below wins over its counterpart above as far as > concision is concerned). Conciseness can be improved with "!!((reg_val >> 9) & 1)". -Scott