]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
simplify mask construction
authorMark Andrews <marka@isc.org>
Tue, 1 May 2018 00:08:23 +0000 (10:08 +1000)
committerOndřej Surý <ondrej@sury.org>
Thu, 3 May 2018 15:17:38 +0000 (17:17 +0200)
(cherry picked from commit 22fab3199fad15cd2dda526c63f4d95c38b67671)

lib/dns/dst_parse.c

index 69d6ce01467096f0d9370fde04a47bcbbb85e08b..f7a6b0e3d3bfe634ee52f42066e6b5fc328f1053 100644 (file)
@@ -33,7 +33,6 @@
 
 /*%
  * Principal Author: Brian Wellington
- * $Id: dst_parse.c,v 1.29 2011/08/18 23:46:35 tbox Exp $
  */
 
 #include <config.h>
@@ -208,9 +207,7 @@ check_rsa(const dst_private_t *priv, isc_boolean_t external) {
                have[i] = ISC_TRUE;
        }
 
-       mask = ~0;
-       mask <<= sizeof(mask) * 8 - TAG_SHIFT;
-       mask >>= sizeof(mask) * 8 - TAG_SHIFT;
+       mask = (1ULL << TAG_SHIFT) - 1;
 
        if (have[TAG_RSA_ENGINE & mask])
                ok = have[TAG_RSA_MODULUS & mask] &&
@@ -310,9 +307,7 @@ check_eddsa(const dst_private_t *priv, isc_boolean_t external) {
                have[i] = ISC_TRUE;
        }
 
-       mask = ~0;
-       mask <<= sizeof(mask) * 8 - TAG_SHIFT;
-       mask >>= sizeof(mask) * 8 - TAG_SHIFT;
+       mask = (1ULL << TAG_SHIFT) - 1;
 
        if (have[TAG_EDDSA_ENGINE & mask])
                ok = have[TAG_EDDSA_LABEL & mask];