hammingweight Questions
4
I am using the BRIEF descriptor in OpenCV in Visual C++ 2010 to match points in two images.
In the paper about the BRIEF-descriptor is written that it is possible to speed up things:
"The BRIEF...
Giuditta asked 17/4, 2012 at 9:5
10
Solved
How can I get the number of "1"s in the binary representation of a number without actually converting and counting ?
e.g.
def number_of_ones(n):
# do something
# I want to MAKE this FASTER (co...
Ladida asked 9/5, 2009 at 18:54
3
I was trying to how many 1 in 512MB memory and I found two possible methods, _mm_popcnt_u64() and __builtin_popcountll() in the gcc builtins.
_mm_popcnt_u64() is said to use the CPU introduction S...
Conidiophore asked 30/6, 2016 at 3:2
8
Solved
So I had an interview question before regarding bit manipulation. The company is a well known GPU company. I had very little background in assembly language (weird despite being a phd student in co...
Mystery asked 1/4, 2013 at 1:49
24
Solved
I have a set of five boolean values. If more than one of these are true I want to excecute a particular function. What is the most elegant way you can think of that would allow me to check this con...
Lustrate asked 18/12, 2008 at 14:27
5
Solved
I'm looking for a fast way to calculate the hamming weight/population count/"the number of 1 bits" of a BINARY(1024) field. MySQL has a BIT_COUNT function that does something like that. I couldn't ...
Teamwork asked 6/5, 2011 at 20:1
2
Solved
Please how can we efficiently calculate the hamming-weight of a bit-string in elixir?
Example: 0b0101101001 has a Hamming-weight of 5 (i.e. 5 bits set)
My Attempt:
iex> Enum.count(Integer.to_...
Dynamometer asked 2/12, 2015 at 17:42
9
Solved
I have a 32 Bit number and want to count know how many bits are 1.
I'm thinking of this pseudocode:
mov eax, [number]
while(eax != 0)
{
div eax, 2
if(edx == 1)
{
ecx++;
}
shr eax, 1
}
Is...
Manhood asked 28/5, 2010 at 18:19
5
Solved
I want to count the number of bits in a binary number that are set.
For example, user enter the number 97 which is 01100001 in binary. The program should give me that 3 bits are set using MIPS ISA....
Pennate asked 22/9, 2010 at 4:5
4
Solved
int SWAR(unsigned int i)
{
i = i - ((i >> 1) & 0x55555555);
i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) ...
Mitten asked 27/2, 2014 at 22:16
2
Solved
I have following task:
Count how many numbers between 1 and N will have exactly K zero non-leading bits. (e.g. 710=1112 will have 0 of them, 4 will have 2)
N and K satisfy condition 0 ≤ K, N ≤ 1000...
Crag asked 7/3, 2021 at 18:45
4
Solved
Is there a method similar to Java's Integer.bitCount(int) or Long.bitCount(long) anywhere in the .NET Framework?
(For those unfamiliar with these Java methods) this is also known as:
Hamming Wei...
Canticle asked 6/5, 2011 at 10:37
7
Solved
I have got a binary number of length 8 for eg 00110101 There are 8 bits set.
I need a fast bit count to determine the number of set bits, the popcount aka population count.
Running the algo like th...
Locomotive asked 9/8, 2011 at 15:23
3
Does anyone know how to check from C# whether the CPU supports popcount (population count)?
I'm trying to port some chess code from C++ to C#.
Posey asked 23/5, 2011 at 13:10
4
Solved
I should count the number of set bits of a __m128i register.
In particular, I should write two functions that are able to count the number of bits of the register, using the following ways.
The t...
Illumination asked 27/6, 2013 at 23:37
3
Using the c program:
int main(int argc , char** argv)
{
return __builtin_popcountll(0xf0f0f0f0f0f0f0f0);
}
and the compiler line (gcc 4.4 - Intel Xeon L3426):
gcc -msse4.2 poptest.c -o popte...
Cathrine asked 21/6, 2011 at 15:2
8
Solved
I need C code to return the number of 1's in an unsigned char in C. I need an explanation as to why it works if it's not obvious. I've found a lot of code for a 32-bit number but not much for an un...
Monti asked 30/3, 2009 at 16:36
1
Solved
My processor (Intel i7) supports the POPCNT instruction and I would like to call it from my C# application. Is this possible?
I believe I read somewhere that it isn't, but the JIT will invoke it i...
Scalawag asked 13/3, 2015 at 19:34
2
Solved
I want an algorithm to compute all permutations of a fixed size binary number with a given hamming weight. For example, if the hamming weight is 2 and the binary size is 4 then there are these outp...
Ferren asked 3/1, 2015 at 14:4
4
Solved
I'm trying to count how many number 1, are in the numbers of an array.
First I have a code in C lenguaje(work ok):
int popcount2(int* array, int len){
int i;
unsigned x;
int result=0;
for (i...
Wellfavored asked 20/11, 2014 at 22:13
9
Solved
Given a MATLAB uint32 to be interpreted as a bit string, what is an efficient and concise way of counting how many nonzero bits are in the string?
I have a working, naive approach which loops ove...
Bost asked 21/6, 2009 at 22:40
2
Solved
I'm implementing an ultra fast popcount on Intel Xeon® Phi®, as it's a performance hotspot of various bioinformatics software.
I've implemented five pieces of code,
#if defined(__MIC__)
#include ...
Brilliancy asked 23/4, 2013 at 8:26
2
Solved
Assume we have a integer of bitsize n=4;
The problem I am describing is how you would go about indexing a number to an array position based on the Hamming weight and its value knowing the bitsize. ...
Kliman asked 24/11, 2012 at 15:53
8
Solved
I have a program that is making a huge number of calls to Long.bitCount(), so many that it is taking 33% of cycles on one CPU core. Is there a way to implement it that is faster than the Sun JDK ve...
Prod asked 29/1, 2011 at 20:6
4
Solved
I'm looking for the fastest way to popcount on large buffer of 512 or more bytes. I can guarantee any required alignment, and the buffer size is always a power of 2. The buffer corresponds to block...
Takeo asked 12/9, 2010 at 6:28
1 Next >
© 2022 - 2024 — McMap. All rights reserved.