From eb196815d670f0937d2117ff0f2b885bd23c80de Mon Sep 17 00:00:00 2001 From: Charles Date: Mon, 17 Jan 2022 23:18:54 +0800 Subject: [PATCH] Avoid calculating size of size class twice & delete sc_data_global. --- src/sc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/sc.c b/src/sc.c index 37683ff4..9a0f76d5 100644 --- a/src/sc.c +++ b/src/sc.c @@ -13,8 +13,6 @@ * at least the damage is compartmentalized to this file. */ -sc_data_t sc_data_global; - static size_t reg_size_compute(int lg_base, int lg_delta, int ndelta) { return (ZU(1) << lg_base) + (ZU(ndelta) << lg_delta); @@ -64,9 +62,8 @@ size_class( sc->lg_base = lg_base; sc->lg_delta = lg_delta; sc->ndelta = ndelta; - sc->psz = (reg_size_compute(lg_base, lg_delta, ndelta) - % (ZU(1) << lg_page) == 0); - size_t size = (ZU(1) << lg_base) + (ZU(ndelta) << lg_delta); + size_t size = reg_size_compute(lg_base, lg_delta, ndelta); + sc->psz = (size % (ZU(1) << lg_page) == 0); if (index == 0) { assert(!sc->psz); }