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

Function RemoveChunk

source/fuzz/shrinker.cpp:43–61  ·  view source on GitHub ↗

A helper to return a transformation sequence identical to |transformations|, except that a chunk of size |chunk_size| starting from |chunk_index| x |chunk_size| is removed (or as many transformations as available if the whole chunk is not).

Source from the content-addressed store, hash-verified

41// |chunk_size| is removed (or as many transformations as available if the whole
42// chunk is not).
43protobufs::TransformationSequence RemoveChunk(
44 const protobufs::TransformationSequence& transformations,
45 uint32_t chunk_index, uint32_t chunk_size) {
46 uint32_t lower = chunk_index * chunk_size;
47 uint32_t upper = std::min((chunk_index + 1) * chunk_size,
48 NumRemainingTransformations(transformations));
49 assert(lower < upper);
50 assert(upper <= NumRemainingTransformations(transformations));
51 protobufs::TransformationSequence result;
52 for (uint32_t j = 0; j < NumRemainingTransformations(transformations); j++) {
53 if (j >= lower && j < upper) {
54 continue;
55 }
56 protobufs::Transformation transformation =
57 transformations.transformation()[j];
58 *result.mutable_transformation()->Add() = transformation;
59 }
60 return result;
61}
62
63} // namespace
64

Callers 1

RunMethod · 0.85

Calls 1

Tested by

no test coverage detected