1 // SPDX-License-Identifier: GPL-2.0 1 // SPDX-License-Identifier: GPL-2.0 2 #include <byteswap.h> 2 #include <byteswap.h> 3 #include "memswap.h" 3 #include "memswap.h" 4 #include <linux/types.h> 4 #include <linux/types.h> 5 5 6 void mem_bswap_32(void *src, int byte_size) 6 void mem_bswap_32(void *src, int byte_size) 7 { 7 { 8 u32 *m = src; 8 u32 *m = src; 9 while (byte_size > 0) { 9 while (byte_size > 0) { 10 *m = bswap_32(*m); 10 *m = bswap_32(*m); 11 byte_size -= sizeof(u32); 11 byte_size -= sizeof(u32); 12 ++m; 12 ++m; 13 } 13 } 14 } 14 } 15 15 16 void mem_bswap_64(void *src, int byte_size) 16 void mem_bswap_64(void *src, int byte_size) 17 { 17 { 18 u64 *m = src; 18 u64 *m = src; 19 19 20 while (byte_size > 0) { 20 while (byte_size > 0) { 21 *m = bswap_64(*m); 21 *m = bswap_64(*m); 22 byte_size -= sizeof(u64); 22 byte_size -= sizeof(u64); 23 ++m; 23 ++m; 24 } 24 } 25 } 25 } 26 26
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.