From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1kmlkn-0004yd-Qp for mharc-grub-devel@gnu.org; Tue, 08 Dec 2020 17:46:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36906) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmlkk-0004sL-UZ for grub-devel@gnu.org; Tue, 08 Dec 2020 17:46:38 -0500 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]:33238) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kmlkd-0000lt-F4 for grub-devel@gnu.org; Tue, 08 Dec 2020 17:46:38 -0500 Received: by mail-ot1-x334.google.com with SMTP id b18so387739ots.0 for ; Tue, 08 Dec 2020 14:46:31 -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=su0w8pRtZr6v6Bnz3WRIMbYYQDDEnkpcSTZWYXy+J+U=; b=AHkLTVOe7azbHx2GjQ0rtflTitSV5Vajl+gc9VfX7cAdqFag2suVgcYhxl20FWrLJI 5rP8rIlHvwBF0NrY2QeiqtEw12QK9zkTcBjta55xfGD2/QFALcVGr/CxBNBWQ3H9fnbH VXP6/csZ1pfpiOcuez+H9VQRVdUha7IQq7cjRhhnpqHbh1HyE8hk2vIDou/5MwMHkTBy 3tkSVe3Iw0M4Zib1VMHn+0OGBvZVqJ9/wtCqvl/grciGzq746CnFdwo7SuIqUlYWkq5+ IbifmH8CkUamR6OkPTQa8QeXwquaINV5+7m0I0xa9UEy5pVhxdP5r5v78jP4lazMU+FY vhUQ== 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=su0w8pRtZr6v6Bnz3WRIMbYYQDDEnkpcSTZWYXy+J+U=; b=SyrIvG0iy+IRqZQyg7WimwKVtGO9L4L0Mja4eUz+AZUNRR4m5M00jDDYY3Lpv3wMUV cY+FX/M1Q3DzcWWOma4bHsHq+V5Bs0pMchv5kHVreyAcdJ6FCMI4Sz78UCQselihluFK U3Tm+TYsBxlEL/5crdHQ2EZzD5VhterMXfVZcD01LGZ2rbat2Fo7CWWGUDztP4f485eL mN5wSG3uLJMDqKg7iGbwO13YrTUo1ueK5wSn8greRoT4lAJGNewSI6k1HvKyu9n5UDo3 y/+8buZT0CjTMbywM4L8E5ADjdsOTS4A6f5exJAXkYTpSsB4Siuh7kLF4p0xaPZSCXTa efCg== X-Gm-Message-State: AOAM533Ma/edliCMM3ruWfEt+ny3VMuljhaErIV6uqwhT+CRtBqI8H2H bh/F/uG3ZpBGO6fo1EUOiWEFdLOurY1WtQ== X-Google-Smtp-Source: ABdhPJz0r7SfFBtGpovFJYxC4Caa5W9Or2TYoFWTYsIz0DeIXIb4VIpT9+S/aGgfLb8Fkh1RSZ09tg== X-Received: by 2002:a05:6830:22c9:: with SMTP id q9mr305827otc.48.1607467590241; Tue, 08 Dec 2020 14:46:30 -0800 (PST) Received: from crass-HP-ZBook-15-G2.attlocal.net ([136.49.211.192]) by smtp.gmail.com with ESMTPSA id v8sm45538otp.10.2020.12.08.14.46.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Dec 2020 14:46:29 -0800 (PST) From: Glenn Washburn To: grub-devel@gnu.org Cc: Patrick Steinhardt , Daniel Kiper , Glenn Washburn , Daniel Kiper Subject: [PATCH v8 17/18] misc: Add grub_log2ull macro for calculating log base 2 of 64-bit integers Date: Tue, 8 Dec 2020 16:45:48 -0600 Message-Id: <302862ec1f4b3827c5dcb7a1bbba19502f931298.1607466704.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::334; envelope-from=development@efficientek.com; helo=mail-ot1-x334.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: Tue, 08 Dec 2020 22:46:39 -0000 Signed-off-by: Glenn Washburn Reviewed-by: Daniel Kiper --- 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