From 04a731265e422c5e0992dd9f855d6b0897f15bff Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 16 Nov 2020 10:51:13 +0000 Subject: [PATCH] Drop slides about proving power of 2 function. --- 2020-frama-c/5000-power-of-2.html | 18 ------------------ 2020-frama-c/5100-power-of-2.html | 20 -------------------- 2 files changed, 38 deletions(-) delete mode 100644 2020-frama-c/5000-power-of-2.html delete mode 100644 2020-frama-c/5100-power-of-2.html diff --git a/2020-frama-c/5000-power-of-2.html b/2020-frama-c/5000-power-of-2.html deleted file mode 100644 index ccc3759..0000000 --- a/2020-frama-c/5000-power-of-2.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - -

nbdkit is_power_of_2

- -
-  /* Returns true if v is a power of 2.
-   *
-   * Uses the algorithm described at
-   * http://graphics.stanford.edu/~seander/bithacks.html#DetermineIfPowerOf2
-   */
-  static inline bool
-  is_power_of_2 (unsigned long v)
-  {
-    return v && ((v & (v - 1)) == 0);
-  }
-
diff --git a/2020-frama-c/5100-power-of-2.html b/2020-frama-c/5100-power-of-2.html deleted file mode 100644 index c9c04c7..0000000 --- a/2020-frama-c/5100-power-of-2.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - -

nbdkit is_power_of_2

- -
-  /*@
-    predicate positive_power_of_2 (integer i) =
-      i > 0 &&
-      (i == 1 || ((i & 1) == 0 && positive_power_of_2 (i >> 1)));
-
-    lemma positive_power_of_2 (1);
-    lemma positive_power_of_2 (2);
-    lemma positive_power_of_2 (4);
-    lemma !positive_power_of_2 (7);
-   */
-
- -https://stackoverflow.com/questions/64268418/how-do-i-write-an-is-power-of-2-predicate-in-acsl -- 1.8.3.1