From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E146C77B7E for ; Tue, 2 May 2023 15:22:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233560AbjEBPWb (ORCPT ); Tue, 2 May 2023 11:22:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234078AbjEBPWa (ORCPT ); Tue, 2 May 2023 11:22:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 270E22123 for ; Tue, 2 May 2023 08:22:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B2B0C625D8 for ; Tue, 2 May 2023 15:22:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E1C0C4339B; Tue, 2 May 2023 15:22:14 +0000 (UTC) Date: Tue, 2 May 2023 11:22:12 -0400 From: Steven Rostedt To: Peter Zijlstra Cc: Indu Bhagat , linux-toolchains@vger.kernel.org, daandemeyer@meta.com, andrii@kernel.org, kris.van.hees@oracle.com, elena.zannoni@oracle.com, nick.alcock@oracle.com Subject: Re: [POC 3/5] sframe: add new SFrame library Message-ID: <20230502112212.67b251eb@gandalf.local.home> In-Reply-To: <20230502104125.GN1597476@hirez.programming.kicks-ass.net> References: <20230501200410.3973453-1-indu.bhagat@oracle.com> <20230501200410.3973453-4-indu.bhagat@oracle.com> <20230502104125.GN1597476@hirez.programming.kicks-ass.net> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-toolchains@vger.kernel.org On Tue, 2 May 2023 12:41:25 +0200 Peter Zijlstra wrote: > > +{ > > + /* Type size of the start_addr in an FRE. */ > > + size_t saddr_tsize = 0; > > + > > + switch (fre_type) { > > + case SFRAME_FRE_TYPE_ADDR1: > > + saddr_tsize = sizeof(uint8_t); > > + break; > > + case SFRAME_FRE_TYPE_ADDR2: > > + saddr_tsize = sizeof(uint16_t); > > + break; > > + case SFRAME_FRE_TYPE_ADDR4: > > + saddr_tsize = sizeof(uint32_t); > > + break; > > + default: > > + /* No other value is expected. */ > > + break; > > + } > > + return saddr_tsize; > > return 1 << fre_type; > > was too complicated? I would argue that the above is easier for the reviewer, but yes, the "1 << fre_type" works too, and is more efficient, but requires a comment that explains it. It would also require a comment stating the dependency to this by the enum definition. -- Steve