Questions tagged [uint8t]

uint8_t (C language - Type). uint8_t stores an 8-bit unsigned number, from 0 to 255. It is equal to unsigned char.

272 questions
1
vote
1 answer

How to convert a QString containing a hex value to an uint?

QString samp_buff[100]; QByteArray data; uint8_t speed; samp_buff[3] = data.toHex(); //I converted the QByteArray into a string qDebug() << "read_every_data_"<< samp_buff[3]; speed = samp_buff[3].toUInt(); //Trying to convert the string to…
1
vote
0 answers

crash when clearing uint8_t on pic18f67k22

I'm adding a clock to my program, but for some reason I cannot lower the value of my "sec" variable. I have a millisecond timer that raises a flag every ms. So, every 1000 ms I clear the ms variable; this happens without a problem. Now every 10 (for…
1
vote
2 answers

Convert Int64 array to Int8 in Julia gives InexactError: trunc(Int8, -9223372036854775808)

I try to convert a part of an julia df from Int64 to Int8. input: array = convert(Array{Int8} , array ); output: InexactError: trunc(Int8, -9223372036854775808) Stacktrace: [1] throw_inexacterror(f::Symbol, #unused#::Type{Int8}, val::Int64) …
Benedikt Schwab
  • 49
  • 1
  • 1
  • 3
1
vote
0 answers

C++ Convert to hex and store the result in uint8_t

std::stringstream sstream; uint8_t data[1] = { }; int x =1; sstream << "0x" << std::hex << x; //sstream = 0x04b35cc8 "0x1" why the sstream not be only "0x1" uint8_t result= (uint8_t)sstream.str().c_str();// result= 80 …
user216905
  • 31
  • 1
  • 7
1
vote
3 answers

initialize uint8_t array from txt file

I have, in a .txt file, a uint8_t array already formatted, like this: 0x4d, 0x5a, 0x90, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, What I need is to initialize…
DreamY
  • 13
  • 3
1
vote
0 answers

enum size and initialization of variable

Even setting the size of an enum is not enough to be able to assign it to a variable of the same size (http://coliru.stacked-crooked.com/a/edd287393f172abd): #include #include enum class Command : uint8_t { CMD1 = 0x48, …
vegalock
  • 51
  • 7
1
vote
3 answers

How to convert a hex string to a uint8_t array? (C language)

how can I convert a hex string to a uint8_t array? My string is 02012B1530A6E3958A98530031902003876940000000000CDF9844173BE512AFFFFFFE11DBBA1F00079387800E13012E11FC017FFFFFFFFE39C10F40 and I want to convert it into this array: uint8_t array_uint[] =…
user14677223
1
vote
3 answers

How do I cast a float pointer to a uint8_t pointer in Metal Shader Language?

I am trying to write the following C code in Metal Shading Language inside of a kernel void function: float f = 2.1; uint8_t byteArray[sizeof(f)]; for (int a = 0; a < sizeof(f); a++) { byteArray[a] = ((uint8_t*)&f)[a]; } The code is supposed to…
Todd
  • 500
  • 4
  • 10
1
vote
3 answers

Do I need to use `uint8_t` to do arithmetics on a `uint8_t` pointer?

I have an array of unsigned 8 bit integer, however the length of this array can be higher than 255. I want to use pointer arithmetics instead of array indexing. Can someone explain me if the following code is acceptable or not? My doubt is that the…
JJAlberto
  • 23
  • 5
1
vote
1 answer

what does numpy if the value in an array exceeds int8

Consider the following piece of code: test = np.ones((200,200)) test = test*20000 test_int8 = test.astype(np.int8) When I implement this, I get that test_int8 is filled with 32, why? and in general, if there's an array whose values exceed the…
Schach21
  • 412
  • 4
  • 21
1
vote
3 answers

Turning a bitfield into a uint8_t

My bitfield below represents the 7 status flags for the 6502 CPU. I am trying to emulate the instruction php, which pushes a copy of the status flags onto the stack. struct Flags { uint8_t C: 1; uint8_t Z: 1; uint8_t I: 1; uint8_t D:…
Caspian Ahlberg
  • 934
  • 10
  • 19
1
vote
2 answers

Confusion between uint8_t and unsigned char

I am trying to call void process (uint8_t* I1,uint8_t* I2,float* D1,float* D2,const int32_t* dims); from a header file, using the following int n=10; size_t size=n*n*sizeof(uint8_t); uint8_t* I1 = (uint8_t*)malloc(size); uint8_t* I2…
Zeyad Khattab
  • 91
  • 1
  • 1
  • 4
1
vote
1 answer

React Native base64 Image to Uint8ClampedArray

I had functionality to pick an image of QRcode from CameraRoll of Android and iOS in react-native and once the user had picked an image. I will use something like jsQR to decode that and validate if its a real qr code or not. But on jsQR lib they…
joyce
  • 165
  • 3
  • 12
1
vote
2 answers

how to convert an ostringstream hex string character pairs to a single unit8_t equivalent binary value

I am trying to do the following: I have an assembled ostringstream object that contains a hex payload to be transmitted. Say, it might be 03125412349876543210af (this is representing the data using hex convention in my string) This string is…
Spangas
  • 15
  • 2
1
vote
3 answers

Is there any way to replace/substitute an array data points in uint8 data

I have this data old= array([[171, 171, 171, ..., 170, 170, 170], [171, 171, 171, ..., 170, 170, 170], [171, 171, 171, ..., 170, 170, 170], ..., [ 17, 17, 17, ..., 17, 17, 17], [ 17, 17, 17, ..., 17, 17, …
Zewo
  • 153
  • 1
  • 12