diff --git a/include/llvm/Support/Endian.h b/include/llvm/Support/Endian.h index 81690605e87..2c5ab74aa36 100644 --- a/include/llvm/Support/Endian.h +++ b/include/llvm/Support/Endian.h @@ -56,6 +56,15 @@ inline value_type read(const void *memory) { return byte_swap(ret); } +/// Read a value of a particular endianness from a buffer, and increment the +/// buffer past that value. +template +inline value_type readNext(const unsigned char *&memory) { + value_type ret = read(memory); + memory += sizeof(value_type); + return ret; +} + /// Write a value to memory with a particular endianness. template