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 2E036C77B73 for ; Tue, 2 May 2023 10:41:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233571AbjEBKl5 (ORCPT ); Tue, 2 May 2023 06:41:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233645AbjEBKls (ORCPT ); Tue, 2 May 2023 06:41:48 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A49539B for ; Tue, 2 May 2023 03:41:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=AQfSGrqteQ3UmaNDh0jU3gwbZazJ5BSeWm0eJWdTGc0=; b=P494oJLszgdcLqm5SUPGZzJKOd SnXFCcnSRc696FdfEZxJ7/TvgvyKGF6a5Xd1SbUygIaF/reFT8wz1E6mH/j3hxx6fXFOCkBBog8zk 2w2NjKvEosRIwGzgpWsMQJVsqDBXpCM9Z8M64ZErtdjiH9s9fFqXlEPUAZ+1UddVZW8EQBDKTqfm/ WAj9yCmItziweByVl2xUHNkXBHZPNwZ2hk7ZCbxkFDXT6+IcncXputpBJNK6W+MAAsnxZKCt9kXbv AxenLUbSqCSKrfk6+adxZx6VjeS0MPGl/D5b1ED+KooWxQ6/0/a4ym6/Mrw4clrdHhjwWGzRR7KsC rkS2n4iA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1ptnRm-00GHkR-36; Tue, 02 May 2023 10:41:27 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 01300300193; Tue, 2 May 2023 12:41:26 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id DCEE5265DF89B; Tue, 2 May 2023 12:41:25 +0200 (CEST) Date: Tue, 2 May 2023 12:41:25 +0200 From: Peter Zijlstra To: Indu Bhagat Cc: linux-toolchains@vger.kernel.org, daandemeyer@meta.com, andrii@kernel.org, rostedt@goodmis.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: <20230502104125.GN1597476@hirez.programming.kicks-ass.net> References: <20230501200410.3973453-1-indu.bhagat@oracle.com> <20230501200410.3973453-4-indu.bhagat@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230501200410.3973453-4-indu.bhagat@oracle.com> Precedence: bulk List-ID: X-Mailing-List: linux-toolchains@vger.kernel.org On Mon, May 01, 2023 at 01:04:08PM -0700, Indu Bhagat wrote: > +/* SFrame FRE types. */ > +#define SFRAME_FRE_TYPE_ADDR1 0 > +#define SFRAME_FRE_TYPE_ADDR2 1 > +#define SFRAME_FRE_TYPE_ADDR4 2 > +static size_t sframe_fre_get_start_address_tsize(unsigned int fre_type) That name is just amazing :/ > +{ > + /* 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? > +}