21 #ifndef SBG_STREAM_BUFFER_LE_H
22 #define SBG_STREAM_BUFFER_LE_H
37 int16_t bytesValues[2];
57 #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 0)
68 return bytesValues[0];
79 #if (SBG_CONFIG_BIG_ENDIAN == 1)
80 return bytesValues[1] | (bytesValues[0] << 8);
82 return bytesValues[0] | (bytesValues[1] << 8);
108 uint16_t bytesValues[2];
128 #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 0)
132 bytesValues[0] = *((uint16_t*)pHandle->
pCurrentPtr);
139 return bytesValues[0];
150 #if (SBG_CONFIG_BIG_ENDIAN == 1)
151 return bytesValues[1] | (bytesValues[0] << 8);
153 return bytesValues[0] | (bytesValues[1] << 8);
204 #if (SBG_CONFIG_BIG_ENDIAN == 1)
223 return value.
value >> (32-24);
272 #if (SBG_CONFIG_BIG_ENDIAN == 1)
291 return value.
value >> (32-24);
315 int32_t bytesValues[4];
335 #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 0)
339 bytesValues[0] = *((int32_t*)pHandle->
pCurrentPtr);
346 return bytesValues[0];
359 #if (SBG_CONFIG_BIG_ENDIAN == 1)
360 return bytesValues[3] | (bytesValues[2] << 8) | (bytesValues[1] << 16) | (bytesValues[0] << 24);
362 return bytesValues[0] | (bytesValues[1] << 8) | (bytesValues[2] << 16) | (bytesValues[3] << 24);
388 uint32_t bytesValues[4];
408 #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 0)
412 bytesValues[0] = *((uint32_t*)pHandle->
pCurrentPtr);
419 return bytesValues[0];
432 #if (SBG_CONFIG_BIG_ENDIAN == 1)
433 return bytesValues[3] | (bytesValues[2] << 8) | (bytesValues[1] << 16) | (bytesValues[0] << 24);
435 return bytesValues[0] | (bytesValues[1] << 8) | (bytesValues[2] << 16) | (bytesValues[3] << 24);
486 #if (SBG_CONFIG_BIG_ENDIAN == 1)
509 return value.
value >> (64-40);
558 #if (SBG_CONFIG_BIG_ENDIAN == 1)
581 return value.
value >> (64-40);
630 #if (SBG_CONFIG_BIG_ENDIAN == 1)
655 return value.
value >> (64-48);
704 #if (SBG_CONFIG_BIG_ENDIAN == 1)
729 return value.
value >> (64-48);
778 #if (SBG_CONFIG_BIG_ENDIAN == 1)
805 return value.
value >> (64-56);
854 #if (SBG_CONFIG_BIG_ENDIAN == 1)
881 return value.
value >> (64-56);
926 #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 0)
948 #if (SBG_CONFIG_BIG_ENDIAN == 1)
949 return (lowPart << 32) | highPart;
951 return lowPart | (highPart << 32);
998 #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 0)
1020 #if (SBG_CONFIG_BIG_ENDIAN == 1)
1021 return (lowPart << 32) | highPart;
1023 return lowPart | (highPart << 32);
1073 assert((
sizeof(
size_t) == 8) || ((
sizeof(
size_t) == 4) && (size <= UINT32_MAX)));
1078 return (
size_t)size;
1113 return floatInt.
valF;
1162 return doubleInt.
valF;
1209 #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 0)
1223 #if (SBG_CONFIG_BIG_ENDIAN == 1)
1224 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 8);
1228 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 8);
1270 #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 0)
1284 #if (SBG_CONFIG_BIG_ENDIAN == 1)
1285 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 8);
1289 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 8);
1337 #if (SBG_CONFIG_BIG_ENDIAN == 1)
1338 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 16);
1339 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 8);
1343 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 8);
1344 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 16);
1398 #if (SBG_CONFIG_BIG_ENDIAN == 1)
1399 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 16);
1400 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 8);
1404 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 8);
1405 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 16);
1454 #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 0)
1468 #if (SBG_CONFIG_BIG_ENDIAN == 1)
1469 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 24);
1470 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 16);
1471 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 8);
1475 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 8);
1476 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 16);
1477 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 24);
1519 #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 0)
1533 #if (SBG_CONFIG_BIG_ENDIAN == 1)
1534 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 24);
1535 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 16);
1536 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 8);
1540 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 8);
1541 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 16);
1542 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 24);
1584 #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 0)
1598 #if (SBG_CONFIG_BIG_ENDIAN == 1)
1599 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 56);
1600 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 48);
1601 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 40);
1602 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 32);
1603 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 24);
1604 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 16);
1605 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 8);
1609 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 8);
1610 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 16);
1611 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 24);
1612 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 32);
1613 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 40);
1614 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 48);
1615 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 56);
1657 #if (SBG_CONFIG_UNALIGNED_ACCESS_AUTH == 1) && (SBG_CONFIG_BIG_ENDIAN == 0)
1671 #if (SBG_CONFIG_BIG_ENDIAN == 1)
1672 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 56);
1673 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 48);
1674 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 40);
1675 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 32);
1676 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 24);
1677 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 16);
1678 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 8);
1682 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 8);
1683 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 16);
1684 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 24);
1685 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 32);
1686 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 40);
1687 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 48);
1688 *(pHandle->
pCurrentPtr++) = (uint8_t)(value >> 56);
1720 assert(value <= UINT32_MAX);
1770 floatInt.
valF = value;
1804 doubleInt.
valF = value;
1826 size_t stringLength;
1833 assert(maxSize > 0);
1845 if (stringLength <= maxSize)
1855 SBG_LOG_ERROR(pHandle->
errorCode,
"Trying to store a string of %u bytes into a buffer of %u bytes.", stringLength, maxSize);
1870 size_t stringLength;
1887 stringLength = strlen(pString) + 1;
1889 if (stringLength <= UINT32_MAX)