search for: bithacks

Displaying 10 results from an estimated 10 matches for "bithacks".

2018 Mar 30
0
Floor-integer-div and integer sign operations?
Hacker's Delight or this web page are probably the best references for tricks like this: https://graphics.stanford.edu/~seander/bithacks.html#CopyIntegerSign John On 03/30/2018 03:58 AM, edA-qa mort-ora-y via llvm-dev wrote: > I'm looking for ways to do some basic operations without using branches. > > The key operation I want is a floored/round-to-negative-infinity integer > division (as opposed to the default r...
2018 Mar 30
2
Floor-integer-div and integer sign operations?
I'm looking for ways to do some basic operations without using branches. The key operation I want is a floored/round-to-negative-infinity integer division (as opposed to the default round-to-zero).     7 floordiv 5 = 1     -3 floordiv 5 = -1     -6 floordiv 5 = -2 As I guess that doesn't exist, the operation can be constructed as:    (a/b) + (a>>31) Assuming a is 32 bits. I can
2012 Nov 14
2
[LLVMdev] Question about llvm.ctpop.*
Hi, Following is excerpted from http://llvm.org/releases/3.1/docs/LangRef.html#int_ctpop. How come the return type needs to be consistent with parameter type? i64/i128 seems to be overkill, and i8, i16 are inconvenient. ----------------------------------- declare i8 @llvm.ctpop.i8(i8 <src>) declare i16 @llvm.ctpop.i16(i16 <src>) declare i32 @llvm.ctpop.i32(i32
2018 Aug 01
2
Re: [PATCH v2 nbdkit 4/6] common: Add a directory for common code shared by plugins and filters.
...> + * 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 mod...
2018 Aug 01
0
[PATCH v2 nbdkit 4/6] common: Add a directory for common code shared by plugins and filters.
...THE USE OF THIS 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 +++...
2018 Aug 01
0
Re: [PATCH v2 nbdkit 4/6] common: Add a directory for common code shared by plugins and filters.
...#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....
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
2019 Sep 10
3
[PATCH 0/2] Remove virt-p2v from libguestfs
Now that virt-p2v has its own repository [1] and releases [2], it is time to remove it from libguestfs. [1] https://github.com/libguestfs/virt-p2v [2] http://download.libguestfs.org/virt-p2v/ Pino Toscano (2): Remove virt-p2v Remove remaining virt-p2v bits .gitignore | 4 - Makefile.am | 7 +- bash/Makefile.am