Questions tagged [uint32]

uint32 is a datatype that represents an unsigned integer and is coded on 32 bits in memory.

uint32 is a datatype that represents an and is coded on 32 bits in memory. Unlike its counterpart which is , uint32 can only be used to store positive integers, of values between 0 and 232 - 1.

176 questions
6
votes
1 answer

In Kotlin, whats the cleanest way to convert a Long to uint32 ByteArray and an Int to uint8?

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 { val bytes = ByteArray(4) …
A.Sanchez.SD
  • 1,950
  • 2
  • 18
  • 23
5
votes
4 answers

How to map uint in NHibernate with SQL Server 2005

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 Dialect does not support DbType.UInt32 What would…
Krzysztof Kozmic
  • 27,267
  • 12
  • 73
  • 115
5
votes
4 answers

Extract upper and lower word of an unsigned 32-bit integer

To extract the upper and lower word of an unsigned 32-bit integer and store each one in separate uint16_t-variables I do as follows (nbr is an unsigned 32-bit integer): uint16_t lower_word = (uint16_t) nbr & 0x0000FFFF; // mask desired…
Abdel Aleem
  • 667
  • 10
  • 15
5
votes
1 answer

unsigned int is not uint32_t when compile to cortex-m0 -- possible C compiler flag issue

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, target device: nrf51822 which is arm cortex-m0. I use gnu…
Dati
  • 89
  • 1
  • 6
4
votes
5 answers

C# convert from uint[] to byte[]

This might be a simple one, but I can't seem to find an easy way to do it. I need to save an array of 84 uint's into an SQL database's BINARY field. So I'm using the following lines in my C# ASP.NET project: //This is what I have uint[]…
ahmd0
  • 16,633
  • 33
  • 137
  • 233
4
votes
1 answer

Why does different types of array subscript used to iterate affect auto vectorization

As following code shows, why uint32_t prevents the compiler (GCC 12.1 + O3) from optimizing by auto vectorization. See godbolt. #include // no auto vectorization void test32(uint32_t *array, uint32_t &nread, uint32_t from, uint32_t to) { …
Adonis Ling
  • 131
  • 3
4
votes
4 answers

uint32_t does not name a type - VSCode with STM32 in Windows

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 the Makefile toolchain for programming in Visual…
Isaac Middlemiss
  • 208
  • 2
  • 4
  • 13
4
votes
3 answers

Java uint32 (stored as long) to 4 byte array

I'm writing to a storage format that has uint32, with a max allowed value of "4294967295". Integer in Java is, of course, just under half that at "2147483647". So internally, I have to use either Long or Guava's UnsignedInteger. To write to this…
user2887053
  • 103
  • 1
  • 2
  • 8
4
votes
3 answers

Convert uint32 floating point representation to uint8

Without going into too many details, I have two embedded systems, neither of which can use the floating point library. In between them is a mobile application, where some calculations are performed. One calculation needs to keep the precision. This…
DigitalNinja
  • 1,078
  • 9
  • 17
4
votes
2 answers

Strange behaviour of int inside a struct

Let's say we have this kind of a struct (one of the simplest ever): type some struct{ I uint32 } And we want to have a variable of that type and to atomically increment in for loop (possibly in another goroutine but now the story is different).…
Gonzalez
  • 681
  • 1
  • 11
  • 21
4
votes
2 answers

How to convert a String to UInt32 in Swift

let temp: String = "0xffeeffff" How to convert above String to UInt32, because I need to store it in the bitmap which only accept UInt32
shixiaoz
  • 73
  • 1
  • 7
3
votes
1 answer

How to display all values of uint32 array in variable browser?

I have a struct as shown below: I have a problem with this struct. In some fields, instead of the values as in the other fields, it's written 48x1 uint32. I want to have to numbers as in the other fields, for example [23;45;67]. My problem is that…
Ahinoa
  • 75
  • 7
3
votes
2 answers

C# getting upper 4 bits of uint32 starting with first significant bit

My need is - have some (in-fact pseudo) random number of uint32, i need it's 4 first bits stating with 1st bit, which in not 0, e.g. ...000100101 => 1001 1000...0001 => 1000 ...0001 => 0001 ...0000 => 0000 etc I understand i have to use something…
user7803907
  • 301
  • 3
  • 11
3
votes
2 answers

How to force PHP to treat a number like a uint

I have some C# code that looks like this: uint a = 0x9E3779B9; a += (uint)(url[k + 0] + (url[k + 1] << 8) + (url[k + 2] << 16) + (url[k + 3] << 24)); After that code, a == 228 452 386 Now I'm trying to translate this C# code to PHP, but in PHP the…
Pete Michaud
  • 1,813
  • 4
  • 22
  • 36
3
votes
2 answers

Convert UInt32 (UTF-32) to String in Swift

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(myUInt32Array) // error let myString =…
Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
1
2
3
11 12