Displaying 6 results from an estimated 6 matches for "determineifpowerof2".
2018 Aug 01
2
Re: [PATCH v2 nbdkit 4/6] common: Add a directory for common code shared by plugins and filters.
...DAMAGE.
> + */
> +
> +#ifndef NBDKIT_ISPOWEROF2_H
> +#define NBDKIT_ISPOWEROF2_H
> +
> +#include <stdbool.h>
> +
> +/* 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);
> +}
> +
> +#endif /* NBDKIT_ISPOWEROF2_H */
> diff --git a/common/include/iszero.h b/common/include/iszero.h
> new file mode 100644
> index 00000...
2018 Aug 01
0
[PATCH v2 nbdkit 4/6] common: Add a directory for common code shared by plugins and filters.
...IS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef NBDKIT_ISPOWEROF2_H
+#define NBDKIT_ISPOWEROF2_H
+
+#include <stdbool.h>
+
+/* 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);
+}
+
+#endif /* NBDKIT_ISPOWEROF2_H */
diff --git a/common/include/iszero.h b/common/include/iszero.h
new file mode 100644
index 0000000..331614c
--- /dev/null
+++ b/common/include/iszero.h...
2018 Aug 01
0
Re: [PATCH v2 nbdkit 4/6] common: Add a directory for common code shared by plugins and filters.
..._ISPOWEROF2_H
> > +#define NBDKIT_ISPOWEROF2_H
> > +
> > +#include <stdbool.h>
> > +
> > +/* 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);
> > +}
> > +
> > +#endif /* NBDKIT_ISPOWEROF2_H */
> > diff --git a/common/include/iszero.h b/common/include/iszero...
2018 Aug 01
12
[PATCH v2 nbdkit 0/6] Add truncate filter and other fixes.
I have dropped the map filter from this series for now while I try to
get it working.
However I think the truncate filter is in a good shape. This
incorporates all feedback from Eric's review.
Also there are three small fixes to the filter code, all revealed when
I was testing using multiple filters which we'd not done much of
before.
Rich.
2014 Jan 28
11
[PATCH 00/10] New API: disk-create for creating blank disks.
A lot of code runs 'qemu-img create' or 'truncate' to create blank
disk images.
In the past I resisted adding an API to do this, since it essentially
duplicates what you can already do using other tools (ie. qemu-img).
However this does simplify calling code quite a lot since qemu-img is
somewhat error-prone to use (eg: don't try to create a disk called
"foo:bar")
2017 Aug 03
9
[PATCH 0/6] tests: Fix handling of device API parameters (RHBZ#1477623).
https://bugzilla.redhat.com/show_bug.cgi?id=1477623
The first two patches are cleanups.
The third patch changes the way that we handle Device and Dev_or_Path
parameters so that a parameter marked as such can really only contain
a block device name (and not, for instance, a chardev). Using a
chardev here caused hangs in the API.
The next two patches fix API usage to conform to this new stricter