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
2
votes
2 answers

Casting int16_t to uint_8t*

I have a library driven result stored as an int16_t value (and it is a negative, which I can use the absolute value of) and another library function that requires this value a few steps later in the form uin8_t*. How can this be done without using…
Orbiting Eden
  • 1,522
  • 13
  • 16
2
votes
1 answer

uint8_t to String, leads to no output C++ (Beginner programer)

I'm a beginner at programming and I'm trying to build a program for raspberry pi in C++, I started with a program that ouput the UID on the console which was this for(byte i = 0; i < mfrc.uid.size; ++i) { if(mfrc.uid.uidByte[i] < 0x10) { …
2
votes
2 answers

C++ How to convert a vector of size 4 into a 32 bit float

What is the fastest way to convert a vector of size 4 into a 32 bit float? My failed attempt: static bool vec2float32(std::vector bytes, float &result) { if(bytes.size() != 4) return false; uint8_t sign = (bytes.at(0) &…
Blue7
  • 1,750
  • 4
  • 31
  • 55
2
votes
1 answer

What is the fastest way to combine 8 uint8_t into a single uintmax_t?

I am looking to optimize a piece of code that uses popcnt to compute differences between uint8_ts. I figure it'd be faster to combine 8 uint8_ts into a single uintmax_t and use popcnt64 instead so that the popcnt operation doesn't have to be called…
Terry Martin
  • 529
  • 8
  • 20
2
votes
2 answers

Javascript reading local file to UInt8Array fast

How to read local binary file to UInt8Array fast. in below code function readAllBytesAsUInt8Array(path) { var req = new XMLHttpRequest(); req.open("GET", path, false); req.overrideMimeType("text/plain; charset=binary-data"); …
user818117
  • 420
  • 1
  • 5
  • 15
2
votes
1 answer

Why the size of uint8_t is 8 Byte after convert from 20Byte NSData in Objective-C?

I am developing in ios objective-c BLE , I receive the BLE data and print by NSLog like the following: NSData *initialData = [characteristic value]; NSData *startOfFrameData = [initialData subdataWithRange:NSMakeRange(0,…
Wun
  • 6,211
  • 11
  • 56
  • 101
2
votes
1 answer

Will a uint8_t array be terminated by null similar to a char array?

I am working on a project where the function will receive a pointer to a uint8_t array. I am to compare the contents of this with that of a pointer to unsigned char data buffer whose size is not known. I was hoping to use string based functions for…
Febin Sunny
  • 311
  • 1
  • 13
2
votes
1 answer

Sending string as Uint8 buffer

I'm developing a mobile app to communicate with Bluetooth Module. I'm sending data through android app & receiving it on BLE module. I'm using cordova & BLE central plugin for cordova to communicate with the device from android. App seems to work…
MANnDAaR
  • 2,546
  • 7
  • 45
  • 64
2
votes
4 answers

C overflows inside an equation?

a + b overflows 255 back to 4 as I would expect, then c / 2 gives 2 as I expect. But then why does the last example not overflow when evaluating the same two steps? I'm guessing the internal calculation values are stored with more bits, then only…
trapper
  • 11,716
  • 7
  • 38
  • 82
2
votes
3 answers

What happens to a value assigned to take up more than a types available space?

e.g. uint8_t value = 256; debug output: 0 I've read that it does some sort of truncating? I'm not seeing exactly how, any links are appreciated.
Womble
  • 345
  • 3
  • 13
2
votes
2 answers

split uint32 value to uint8 values in swift

in C I have uint32 value = 39434; uint8 firstByte = (unsigned char)value; uint8 secondByte = (unsigned char)(value >> 8); Is there any possibility to achieve the same in Swift?
Dimitrio
  • 151
  • 4
  • 12
2
votes
4 answers

Conversion between uint8 and char in C

I have an API that implements a writing operation to EEPROM. Here is its declaration: CYBLE_API_RESULT_T CyBle_StoreAppData (uint8 * srcBuff, const uint8 destAddr[], uint32 buffLen, uint8 isForceWrite); It is working well when I call this function…
abdullah cinar
  • 543
  • 1
  • 6
  • 20
2
votes
2 answers

converting char* to array of uint8_t (c)

I can make function calls and receive an array of strings that represents ipv6 adress. it looks something like this char* buffer=resolver_getstring(config, INI_BOOT_MESHINTFIPADDRESS); if i printed buffer i will gate the ipv6 adress in string…
lferasu
  • 185
  • 2
  • 10
2
votes
1 answer

Conversion of uchar array to uint8 type pointer

I want to convert a array of uchar to uint8 pointer. As both are of 8 bits and value ranges from 0 to 255 so I do not think it should cause and issue. uchar list[100]; I have to pass above list to a function which accepts pointer to uint8t. Can i…
Prannoy Mittal
  • 1,525
  • 5
  • 21
  • 32
2
votes
3 answers

how to extract byte data from bluetooth heart rate monitor in objective c

Im having trouble understanding bytes and uint8_t values. I am using the sample project created by apple that reads data from a Bluetooth 4.0 heart rate monitor via the heart rate service protocol. THe sample project gives out heart rate data as…
skeg0
  • 95
  • 2
  • 10