@@ -49,7 +49,9 @@ template <typename value_type>
4949
5050// / Swap the bytes of value to match the given endianness.
5151template <typename value_type, endianness endian>
52- [[nodiscard]] inline value_type byte_swap (value_type value) {
52+ [[nodiscard]]
53+ LLVM_DEPRECATED (" Pass endian as a function argument instead" ,
54+ " byte_swap" ) inline value_type byte_swap (value_type value) {
5355 return byte_swap (value, endian);
5456}
5557
@@ -66,7 +68,9 @@ template <typename value_type, std::size_t alignment = unaligned>
6668}
6769
6870template <typename value_type, endianness endian, std::size_t alignment>
69- [[nodiscard]] inline value_type read (const void *memory) {
71+ [[nodiscard]] LLVM_DEPRECATED(" Pass endian as a function argument instead" ,
72+ " read" ) inline value_type
73+ read (const void *memory) {
7074 return read<value_type, alignment>(memory, endian);
7175}
7276
@@ -128,16 +132,16 @@ template <typename value_type, endianness endian, std::size_t alignment>
128132 uint64_t startBit) {
129133 assert (startBit < 8 );
130134 if (startBit == 0 )
131- return read<value_type, endian, alignment>(memory);
135+ return read<value_type, alignment>(memory, endian );
132136 else {
133137 // Read two values and compose the result from them.
134138 value_type val[2 ];
135139 memcpy (&val[0 ],
136140 LLVM_ASSUME_ALIGNED (
137141 memory, (detail::PickAlignment<value_type, alignment>::value)),
138142 sizeof (value_type) * 2 );
139- val[0 ] = byte_swap<value_type, endian >(val[0 ]);
140- val[1 ] = byte_swap<value_type, endian >(val[1 ]);
143+ val[0 ] = byte_swap<value_type>(val[0 ], endian );
144+ val[1 ] = byte_swap<value_type>(val[1 ], endian );
141145
142146 // Shift bits from the lower value into place.
143147 make_unsigned_t <value_type> lowerVal = val[0 ] >> startBit;
@@ -171,8 +175,8 @@ inline void writeAtBitAlignment(void *memory, value_type value,
171175 LLVM_ASSUME_ALIGNED (
172176 memory, (detail::PickAlignment<value_type, alignment>::value)),
173177 sizeof (value_type) * 2 );
174- val[0 ] = byte_swap<value_type, endian >(val[0 ]);
175- val[1 ] = byte_swap<value_type, endian >(val[1 ]);
178+ val[0 ] = byte_swap<value_type>(val[0 ], endian );
179+ val[1 ] = byte_swap<value_type>(val[1 ], endian );
176180
177181 // Mask off any existing bits in the upper part of the lower value that
178182 // we want to replace.
@@ -200,8 +204,8 @@ inline void writeAtBitAlignment(void *memory, value_type value,
200204 val[1 ] |= upperVal;
201205
202206 // Finally, rewrite values.
203- val[0 ] = byte_swap<value_type, endian >(val[0 ]);
204- val[1 ] = byte_swap<value_type, endian >(val[1 ]);
207+ val[0 ] = byte_swap<value_type>(val[0 ], endian );
208+ val[1 ] = byte_swap<value_type>(val[1 ], endian );
205209 memcpy (LLVM_ASSUME_ALIGNED (
206210 memory, (detail::PickAlignment<value_type, alignment>::value)),
207211 &val[0 ], sizeof (value_type) * 2 );
@@ -224,8 +228,8 @@ struct packed_endian_specific_integral {
224228 explicit packed_endian_specific_integral (value_type val) { *this = val; }
225229
226230 value_type value () const {
227- return endian::read<value_type, endian, alignment>(
228- ( const void *)Value. buffer );
231+ return endian::read<value_type, alignment>(( const void *)Value. buffer ,
232+ endian );
229233 }
230234 operator value_type () const { return value (); }
231235
@@ -264,7 +268,7 @@ struct packed_endian_specific_integral {
264268 explicit ref (void *Ptr) : Ptr(Ptr) {}
265269
266270 operator value_type () const {
267- return endian::read<value_type, endian, alignment>(Ptr);
271+ return endian::read<value_type, alignment>(Ptr, endian );
268272 }
269273
270274 void operator =(value_type NewValue) {
0 commit comments