uint32 Questions

6

What is the fastest way to count the number of set bits (i.e. count the number of 1s) in an UInt32 without the use of a look up table? Is there a way to count in O(1)?
Kukri asked 29/8, 2012 at 5:46

4

Solved

i have some low level image/texture operations where 32-bit colors are stored as UInt32 or int and i need a really fast bitwise conversion between the two. e.g. int color = -2451337; //except...
Populate asked 30/8, 2010 at 13:41

7

Solved

Lets say In C++ I got code like this.. void * target uint32 * decPacket = (uint32 *)target; So in C# it would be like.. byte[] target; UInt32[] decPacket = (UInt32[])target; Cannot convert ...
Hampden asked 2/9, 2011 at 20:28

4

I am currently writing code for a project, specifically interfacing with sensors via an STM32 Nucleo F411RE board. I set the pins/peripherals etc. using STM32CubeMX, then generated the code with th...
Trickish asked 10/12, 2018 at 20:58

8

Solved

I am porting an existing application to C# and want to improve performance wherever possible. Many existing loop counters and array references are defined as System.UInt32, instead of the Int32 I w...
Eminence asked 20/11, 2008 at 19:50

5

Solved

What is the difference between Int32 and UInt32? If they are the same with capacity range capabilities, the question is for what reason UInt32 was created? When should I use UInt32 instead of Int3...
Fabien asked 21/2, 2010 at 20:3

1

Solved

fun longToByteArray(value: Long): ByteArray { val bytes = ByteArray(8) ByteBuffer.wrap(bytes).putLong(value) return Arrays.copyOfRange(bytes, 4, 8) } fun intToUInt8(value: Int): ByteArray { va...
Kowtko asked 1/8, 2018 at 22:13

1

Solved

I am looking at the following code: #include <stdio.h> #include <inttypes.h> int main() { uint32_t total = 0; printf("\tTotal: %"PRIu32"\n\n", total); return total; } How does P...
Pony asked 28/8, 2017 at 15:46

6

Solved

What is the maximum value for a UInt32? Is there a way I can use the sizeof operator to get the maximum value (as it is unsigned)? So I don't end up with #defines or magic numbers in my code.
Indurate asked 19/11, 2013 at 11:31

3

Solved

I am trying to generate a random number in Swift: var amountOfQuestions = 2 var randomNumber = Int(arc4random_uniform(amountOfQuestions - 1)) + 1 but this results in the error: Cannot convert val...
Haas asked 22/2, 2016 at 19:56

4

Solved

I have this expression which returns a UInt32: let randomLetterNumber = arc4random()%26 I want to be able to use the number in this if statement: if letters.count > randomLetterNumber{ var ...
Spicy asked 10/6, 2014 at 15:10

2

Solved

I have an array of UInt32 values. I would like to convert this array to a String. This doesn't work: let myUInt32Array: [UInt32] = [72, 101, 108, 108, 111, 128049] let myString = String(myUInt32A...
Saltandpepper asked 15/7, 2015 at 3:34

1

Solved

When to use size_t vs uint32_t? I saw a a method in a project that receives a parameter called length (of type uint32_t) to denote the length of byte data to deal with and the method is for calcula...
Hyacinthhyacintha asked 23/2, 2015 at 22:0

1

Solved

I've needed to port a project to run with Eclipse with its own Makefile. I have modified its makefile, and i guess the error is connected to it or a compiler flag. Host: Virtualbox Win 8,x64, targ...
Quaver asked 25/8, 2014 at 21:54

3

Solved

Edit: This question is out of date as the Polyfill example has been updated. I'm leaving the question here just for reference. Read the correct answer for useful information on bitwise shift operat...
Gesticulate asked 11/3, 2014 at 20:24

4

Solved

When should one use the datatypes from stdint.h? Is it right to always use as a convention them? What was the purpose of the design of nonspecific size types like int and short?
Kahle asked 19/11, 2013 at 16:51

2

Solved

I need a fast, simple hash function that creates a unique identifier for a pair of uint32_t values - so the same hash value for (2,7) and (7,2). Any idea?
Calliopsis asked 20/7, 2013 at 18:43

2

Solved

Possible Duplicate: Difference between different integer types What is the difference between uint32 and uint32_t in C/C++? Are they OS-dependent? In which case should I use one or anothe...
Epigenesis asked 13/11, 2012 at 14:1

3

Solved

I'm working with legacy embedded C code which defines the types uint8_t, uint16_t and uint32_t in a header file using the typedef keyword. For discussion, let us say the file typedefs.h contains ...
Coltish asked 7/9, 2010 at 18:36

4

Solved

I have a property of type uint on my entity. Something like: public class Enity { public uint Count {get;set;} } When I try to persist that into the SQL Server 2005 database, I get an exception...
Midkiff asked 12/3, 2009 at 16:25
1

© 2022 - 2024 — McMap. All rights reserved.