From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1klEgw-0008HD-2L for mharc-grub-devel@gnu.org; Fri, 04 Dec 2020 12:16:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37728) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1klEdS-0007aO-Rw for grub-devel@gnu.org; Fri, 04 Dec 2020 12:12:50 -0500 Received: from mail-qk1-x731.google.com ([2607:f8b0:4864:20::731]:35985) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1klEbv-0007Do-J4 for grub-devel@gnu.org; Fri, 04 Dec 2020 12:12:29 -0500 Received: by mail-qk1-x731.google.com with SMTP id x25so6087893qkj.3 for ; Fri, 04 Dec 2020 09:10:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficientek-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/HPSQoaT5s43U0TWytZhM1ME6BH17oEBrZxvvufb4MQ=; b=1OilWVaHX0J8nUkKkSUjFEOytbPMIONgbjFAon3wFkOo3BjUeoedBqolC5///ON3l6 ZNVF1SQHRToxDK9Dtk3NMhTMNFFCyF/UKRjxhBzPM1yeWHBG0QNJ1I8fb0gnDtwwg5/i e0vmSEC2KKoXehMIv7Y0FC2uGKzZ9j9pJ+DLWWT5NYZEVOmXp4k5AE7iBKlrY7pZCpgM GiSxjw1N+9MQxnNy3En8g8/hvZhJV+L9pREgAk0vwI9ZFspSHR1d3PVGvjdnTQ6oTLvd Dk5Os8ftiXw9oEGLN4duRlW4cSEwMWNjXMjs1RbqeUOX4zgLFK6kjBYW1dzcRNg2Osl9 aB5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/HPSQoaT5s43U0TWytZhM1ME6BH17oEBrZxvvufb4MQ=; b=kRSoXv3+M16tKow4+RQ38Y+/vf0yNc01YIeClg5Yt66p9F46GC8eveJej86ff2MXWH V79bcR8NGralN8ukMwaUuPx+Lo9rMb/QxedVc8omxCJ8X5Kxb0OeJQsT8iQrNEMgm0mL IwCUP3l0ZyYSxq/qs6k6L+ocmOoCaiJOJzTAyVQo48CCWNm/kMXnX2Z93bR6qcmDEHUJ 03wCVeHPkdZecpIZAbfXfawkDfOJ9ONzlA9UvfXRQIpETaVAwgUVVsMigXthO/R9PdBQ 2EdgkZ65MR2rFzsJ+Iq5tQ2Gr62k/YGfWBxUs1b5ZGoJT8Py7+2ECER7AeCs9JvrlVpi kqWw== X-Gm-Message-State: AOAM530SA9AVMhsmyRPSxOJMD9lF71xDiWAqdTmJmW714NgbwdPTeo/j NHO4enebwOfS8SAd3SCfveuwhL4NaGXRQg== X-Google-Smtp-Source: ABdhPJxaJcwfu70ErinG0bodI7GTn5z3xbGqjHgN51SfIITkeIvyD8QA5/C6DiWIhlf3hEggr8wIGQ== X-Received: by 2002:a05:6638:3012:: with SMTP id r18mr7426561jak.13.1607100272237; Fri, 04 Dec 2020 08:44:32 -0800 (PST) Received: from localhost.localdomain ([136.49.211.192]) by smtp.gmail.com with ESMTPSA id w3sm1754909iol.9.2020.12.04.08.44.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2020 08:44:31 -0800 (PST) From: Glenn Washburn To: grub-devel@gnu.org Cc: Patrick Steinhardt , Daniel Kiper , Glenn Washburn , Daniel Kiper Subject: [PATCH v7 16/17] misc: Add grub_log2ull macro for calculating log base 2 of 64-bit integers Date: Fri, 4 Dec 2020 10:43:45 -0600 Message-Id: <3b4ccda1f6e50f63f99acff75159141ed9232410.1607098915.git.development@efficientek.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::731; envelope-from=development@efficientek.com; helo=mail-qk1-x731.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 17:12:54 -0000 Reviewed-by: Daniel Kiper Signed-off-by: Glenn Washburn --- include/grub/misc.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/grub/misc.h b/include/grub/misc.h index 780a34e90..73a514eb1 100644 --- a/include/grub/misc.h +++ b/include/grub/misc.h @@ -482,4 +482,7 @@ void EXPORT_FUNC(grub_real_boot_time) (const char *file, #define grub_max(a, b) (((a) > (b)) ? (a) : (b)) #define grub_min(a, b) (((a) < (b)) ? (a) : (b)) +#define grub_log2ull(n) (GRUB_TYPE_BITS (grub_uint64_t) \ + - __builtin_clzll (n) - 1) + #endif /* ! GRUB_MISC_HEADER */ -- 2.27.0