IDF release/v4.0 08219f3cf

This commit is contained in:
me-no-dev
2020-01-25 14:51:58 +00:00
parent 8c723be135
commit 41ba143063
858 changed files with 37940 additions and 49396 deletions

View File

@ -12,8 +12,8 @@
* @brief Bit vector manipulation
*/
#ifndef _COAP_BITS_H_
#define _COAP_BITS_H_
#ifndef COAP_BITS_H_
#define COAP_BITS_H_
#include <stdint.h>
@ -28,9 +28,9 @@
*
* @return @c -1 if @p bit does not fit into @p vec, @c 1 otherwise.
*/
inline static int
COAP_STATIC_INLINE int
bits_setb(uint8_t *vec, size_t size, uint8_t bit) {
if (size <= (bit >> 3))
if (size <= ((size_t)bit >> 3))
return -1;
*(vec + (bit >> 3)) |= (uint8_t)(1 << (bit & 0x07));
@ -48,9 +48,9 @@ bits_setb(uint8_t *vec, size_t size, uint8_t bit) {
*
* @return @c -1 if @p bit does not fit into @p vec, @c 1 otherwise.
*/
inline static int
COAP_STATIC_INLINE int
bits_clrb(uint8_t *vec, size_t size, uint8_t bit) {
if (size <= (bit >> 3))
if (size <= ((size_t)bit >> 3))
return -1;
*(vec + (bit >> 3)) &= (uint8_t)(~(1 << (bit & 0x07)));
@ -67,12 +67,12 @@ bits_clrb(uint8_t *vec, size_t size, uint8_t bit) {
*
* @return @c 1 if the bit is set, @c 0 otherwise.
*/
inline static int
COAP_STATIC_INLINE int
bits_getb(const uint8_t *vec, size_t size, uint8_t bit) {
if (size <= (bit >> 3))
if (size <= ((size_t)bit >> 3))
return -1;
return (*(vec + (bit >> 3)) & (1 << (bit & 0x07))) != 0;
}
#endif /* _COAP_BITS_H_ */
#endif /* COAP_BITS_H_ */