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
0
votes
1 answer

Audio transmitted in uint8_t into a .wav file

I am trying to transmit audio using CAN FD and the data format it sends it is in uint8_t, when the sample I take from the microphone with the ADC is an uint32_t. Will I have any problem trying to insert this uint8_t data into a wav after being…
Suspe18
  • 15
  • 7
0
votes
1 answer

How to reconstruct a 4 byte uint8 array into a uint32 integer

I have a web app (javascript) that needs to send a arduino(ESP32) a 12bit value (0x7DF). I have a websocket connection that only accepts a Uint8_t payload, so I split the value into 4 bytes (Uint8_t). I can send the array to the arduino, but how do…
hamza765
  • 106
  • 14
0
votes
1 answer

Split uint32 into two uint16

How does one go about splitting a single uint32 var in Go into two uint16 vars, representing the 16 MSB and 16 LSB respectively? Here is a representation of what I am trying to do: var number uint32 var a uint16 var b uint16 number =…
Atif Ali
  • 2,186
  • 2
  • 12
  • 23
0
votes
1 answer

C++ Cast from ‘std::__tuple... {aka ‘unsigned int*’} to ‘uint32_t’ {aka ‘unsigned int’} loses precision

You may have to forgive me as I'm new to C++ and may have made some fundamental errors with the code I have worked up so far. static tuple m_scan_record(bool skip, uint32_t& size, FILE* file) { read_result result; …
0
votes
1 answer

Matlab typecast transfer to python 3.7

I have some excerpt code for Matlab. I want to transfer to python3.7 code. But I found out some Matlab function I can not transfer to python 3.7 it, such as function typecast, and single in Matlab. Therefore, How could I write the python code and…
AAA
  • 9
  • 4
0
votes
1 answer

Are there platforms that do not support uint64_t?

I am working on a project that relies on the standard C datatype uint64_t to multiply 32 bit integers. But I am concerned about portability issues, as I am already re-implementing many parts of my source code in C due to portability reasons. I…
Vivekanand V
  • 340
  • 2
  • 12
0
votes
1 answer

Writing binp file with Python, Reading with Matlab

I am writing a .binp file in Pyton and am trying to read it in Matlab again. The .binp file has an X-Header with 11 parameters and the Y-Header has 7 parameters #Data X[0,0] = 0 X[0,1] = -delta_width/2 X[0,2] = -delta_height/2 X[0,3] = 0.0…
qwertz
  • 619
  • 1
  • 7
  • 15
0
votes
1 answer

ctypes c_uint32 getting passed incorrectly from python to Cpp

I am using python with ctypes to call a C so file. The C structure is: typedef struct { uint32_t var1; uint32_t var2; uint32_t var3; uint8_t var4; uint8_t var5 } struct1; If I call C code where I set the variables of var1 to 0x050A, var2 to 0x102…
0
votes
1 answer

uint32_t equivalent for strings and other data types

my problem is regarding types of variables/values in a file that defines a message which can be exchanged and should be understood by code in multiple programming languages. The example I received was the following: uint32_t x uint32_t y The…
NotARobot
  • 455
  • 2
  • 10
  • 27
0
votes
0 answers

How to read a std::uint32_t from a std::string and saving it back in C++

I have the following case study: The variable "x_y" holds the content of a file in binary mode, read as follows: std::string x_y; std::ifstream fnb(fn, std::ios::in | std::ios::binary); std::stringstream file_jh; file_jh << fnb.rdbuf(); x_y =…
Xigma
  • 177
  • 1
  • 11
0
votes
1 answer

Concatenation of vector elements into one 32-bit word

I am trying to concatenate a vector of four elements into a 4-byte word to represent as an uint32_t. Sorry, I don't have my code, but this is what I am trying to do: vector v; // each element is a byte, with four elements v[0], v[1], v[2], v[3]…
0
votes
1 answer

I don't understand how this code to "write an uint32 inside an array in javascript" works

So basically i have this piece of code that i have found into someone else's code and works fine for the thing i'm trying to do but i will like to understand how it works. I wanna know how it differences from writting an uint32 into an array like…
0
votes
1 answer

How do I convert userdata to a uint32 or float?

How do I convert user data like this: local user_data = { 0x33, 0x22, 0x11, 0x00 } to either a uint32 or float using Lua? I cant find anything in the documentation that talks about this. I've tried various methods and none of these have…
SwDevMan81
  • 48,814
  • 22
  • 151
  • 184
0
votes
0 answers

Why `static_cast(uint32_t)` works unexpected?

The following code does what's expected uint32_t a = 1, b = 2; std::cout << static_cast(a) - b << '\n'; Prints -1. But if I change int64_t to int everything breaks: std::cout << static_cast(a) - b << '\n'; Prints 4294967295. Does…
InFamous X
  • 399
  • 1
  • 4
  • 12
0
votes
1 answer

How to write a uint32 integer into a 4 bytes sequence using numpy?

I have declared a numpy ndarray containing a single unsigned integer: import numpy as np foo=np.array([3600000],dtype='uint32') I would like to store this array into a 4 bytes sequence. I have already tested a few options, such as the…
Sheldon
  • 4,084
  • 3
  • 20
  • 41