283 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
3
answers
568
views
How to cleanly work with enum class and uint8_t without excessive static_cast?
I'm currently working on a performance-oriented chess move generator and using lots of strongly-typed enum class declarations for things like Square, File, Rank, Color, PieceType, Castling, Direction ...
0
votes
1
answer
46
views
Understanding SetArgPointee behavior, and conversion errors
I have a class Bar, with a reference of a class Foo which have a read method. I'm trying to unit test, using gtest, the behavior of the public method Bar::test(), which does something different based ...
3
votes
2
answers
168
views
Check if uint8_t array contains string
In C language I have a uint8_t array and, after some logic, I need to cast to string and check if contains some substring like this:
uint8_t data[8] = {0xcb,0xe2,0x3d,0x96,0x55,0xfc,0xcd,0x43};
//...
1
vote
2
answers
338
views
About the use of uint8_t in C when counting
I wanted to make sure that I understood what is happening in the following code:
#include <stdio.h>
#include <stdint.h>
int main (void)
{
uint8_t a = 255;
a = a + 5;
printf(&...
0
votes
1
answer
453
views
string_view<uint8_t>
I have a big vector of bytes, and I want to take a part of it, interpret these bytes as ASCII characters written in hexadecimal system and print this substring on the screen. I don't need a copy, so I ...
1
vote
1
answer
202
views
Is cast from uint8_t* to char* acceptable
Concerning this question
Convert from uint8_t * to char * in C
The suggestion was simply to cast with (char*). Why is this acceptable in this context? Or did the responder just take the question ...
2
votes
1
answer
415
views
In C++, why would you use `uint8_t` to declare a string? [closed]
As a mobile developer working with React Native, I need to work with a C++ code that creates and encrypts files. I don't have much experience with C++ (the last time I wrote some was over 15 years ago ...
0
votes
1
answer
143
views
Casting uint8_t* to int16_t8 in C
I am attempting to adapt an example from here which reads PDM microphone data and prints it to a computer using serial USB.
I want to bypass the filtering stage in the example so I can write my own ...
0
votes
1
answer
726
views
PN532 RFID with ESP32 (ESP-IDF) Passing uint8_t UID to a string
I am trying to write a fairly basic program in platformio using the esp-idf framework for an esp32. I have the main bits working, but i'm struggling with something that I thought would be very basic!
...
0
votes
4
answers
513
views
How can a double be converted to bytes to be stored in c++?
I am trying to write a program that can take a list of a specific type for example a double or float and convert it into bytes and write it to a file that can be converted back into that original list....
0
votes
1
answer
1k
views
Convert a vector of 3 uint8 to a uint32 in simulink
I had a vector of 3 elements all type uint8 that need to be converted to a uint32, I’m struggling to find the correct block to do that I tried unpacking the signals but then that creates a problem ...
-2
votes
2
answers
391
views
How to convert 32-bit binary value to int8_t array
I'm trying to covert a 32 bit binary value into int8_t array. I'm not sure how to do this, and I'm struggling to find any documentation explaining the process.
I was thinking that each 8 bits ...
0
votes
0
answers
428
views
uint8_t element assignment to uint8_t array in C++
I am trying to create a uint8_t array and try to change the first element of the array, then print it to the terminal as a string.
But, after I assign currBlock (changed block) to arr[0], cout gives ...
0
votes
1
answer
161
views
How to add a uint8_t array into a char*
I have a char *data that is a Datagram to represent the packet I want to send in but I need to insert on that an uint8_t array.
// Datagram to represent the packet
char datagram[4096], source_ip[32], *...
0
votes
0
answers
44
views
if stament with uint8_t
knowing the value of the variable tempStatusSelectorByte is 0, in the if stament it is giving true for tempStatusSelectorByte>4.
uint8_t tempStatusSelectorByte;
tempStatusSelectorByte = ...