26
26
#pragma once
27
27
28
28
#include < limits.h>
29
- #include < nlassert.h>
30
29
#include < stdint.h>
31
30
32
31
namespace chip {
@@ -42,7 +41,7 @@ namespace Uint8 {
42
41
*/
43
42
inline uint8_t * from_uchar (unsigned char * in)
44
43
{
45
- nlSTATIC_ASSERT_PRINT (CHAR_BIT == 8 , " Can't type cast unsigned char array as uint8_t array" );
44
+ static_assert (CHAR_BIT == 8 , " Can't type cast unsigned char array as uint8_t array" );
46
45
#ifdef __cplusplus
47
46
return reinterpret_cast <uint8_t *>(in);
48
47
#else
@@ -59,7 +58,7 @@ inline uint8_t * from_uchar(unsigned char * in)
59
58
*/
60
59
inline const uint8_t * from_const_uchar (const unsigned char * in)
61
60
{
62
- nlSTATIC_ASSERT_PRINT (CHAR_BIT == 8 , " Can't type cast unsigned char array as uint8_t array" );
61
+ static_assert (CHAR_BIT == 8 , " Can't type cast unsigned char array as uint8_t array" );
63
62
#ifdef __cplusplus
64
63
return reinterpret_cast <const uint8_t *>(in);
65
64
#else
@@ -76,7 +75,7 @@ inline const uint8_t * from_const_uchar(const unsigned char * in)
76
75
*/
77
76
inline uint8_t * from_char (char * in)
78
77
{
79
- nlSTATIC_ASSERT_PRINT (CHAR_BIT == 8 , " Can't type cast char array as uint8_t array" );
78
+ static_assert (CHAR_BIT == 8 , " Can't type cast char array as uint8_t array" );
80
79
#ifdef __cplusplus
81
80
return reinterpret_cast <uint8_t *>(in);
82
81
#else
@@ -93,7 +92,7 @@ inline uint8_t * from_char(char * in)
93
92
*/
94
93
inline const uint8_t * from_const_char (const char * in)
95
94
{
96
- nlSTATIC_ASSERT_PRINT (CHAR_BIT == 8 , " Can't type cast char array as uint8_t array" );
95
+ static_assert (CHAR_BIT == 8 , " Can't type cast char array as uint8_t array" );
97
96
#ifdef __cplusplus
98
97
return reinterpret_cast <const uint8_t *>(in);
99
98
#else
@@ -110,7 +109,7 @@ inline const uint8_t * from_const_char(const char * in)
110
109
*/
111
110
inline unsigned char * to_uchar (uint8_t * in)
112
111
{
113
- nlSTATIC_ASSERT_PRINT (CHAR_BIT == 8 , " Can't type cast uint8_t array to unsigned char array" );
112
+ static_assert (CHAR_BIT == 8 , " Can't type cast uint8_t array to unsigned char array" );
114
113
#ifdef __cplusplus
115
114
return reinterpret_cast <unsigned char *>(in);
116
115
#else
@@ -127,7 +126,7 @@ inline unsigned char * to_uchar(uint8_t * in)
127
126
*/
128
127
inline const unsigned char * to_const_uchar (const uint8_t * in)
129
128
{
130
- nlSTATIC_ASSERT_PRINT (CHAR_BIT == 8 , " Can't type cast uint8_t array to unsigned char array" );
129
+ static_assert (CHAR_BIT == 8 , " Can't type cast uint8_t array to unsigned char array" );
131
130
#ifdef __cplusplus
132
131
return reinterpret_cast <const unsigned char *>(in);
133
132
#else
@@ -144,7 +143,7 @@ inline const unsigned char * to_const_uchar(const uint8_t * in)
144
143
*/
145
144
inline char * to_char (uint8_t * in)
146
145
{
147
- nlSTATIC_ASSERT_PRINT (CHAR_BIT == 8 , " Can't type cast uint8_t array to char array" );
146
+ static_assert (CHAR_BIT == 8 , " Can't type cast uint8_t array to char array" );
148
147
#ifdef __cplusplus
149
148
return reinterpret_cast <char *>(in);
150
149
#else
@@ -161,7 +160,7 @@ inline char * to_char(uint8_t * in)
161
160
*/
162
161
inline const char * to_const_char (const uint8_t * in)
163
162
{
164
- nlSTATIC_ASSERT_PRINT (CHAR_BIT == 8 , " Can't type cast uint8_t array to char array" );
163
+ static_assert (CHAR_BIT == 8 , " Can't type cast uint8_t array to char array" );
165
164
#ifdef __cplusplus
166
165
return reinterpret_cast <const char *>(in);
167
166
#else
0 commit comments