I am trying to convert some code from Xcode into React Native.
I have come accross this code:
else if([characteristic.UUID isEqual:self.respCharUUID]) {
uint16_t rpm = 0;
if ((reportData[0] & 0x01) == 0) {
rpm = reportData[1];
}
else {
rpm = CFSwapInt16LittleToHost(*(uint16_t *)(&reportData[1]));
}
However, I do not understand what CFSwapInt16LittleToHost does except in the docs that say:
The integer with its bytes swapped. If the host is little-endian, this function returns arg unchanged.
located here from apple documentation.
Is there a Javascript function that is the same? If so, how would i use it?
Cheers in advance.