MCPcopy Create free account
hub / github.com/KhronosGroup/SPIRV-Tools / WasFileSizeAligned

Function WasFileSizeAligned

tools/io.cpp:71–81  ·  view source on GitHub ↗

Ensure the file contained an exact number of elements, whose size is given in |alignment|.

Source from the content-addressed store, hash-verified

69// Ensure the file contained an exact number of elements, whose size is given in
70// |alignment|.
71bool WasFileSizeAligned(const char* filename, size_t read_size,
72 size_t alignment) {
73 assert(alignment != 1);
74 if ((read_size % alignment) != 0) {
75 fprintf(stderr,
76 "error: file size should be a multiple of %zd; file '%s' corrupt\n",
77 alignment, filename);
78 return false;
79 }
80 return true;
81}
82
83// Different formats the hex is expected to be in.
84enum class HexMode {

Callers 1

ReadBinaryFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected