Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:42:41

0001 //===- Arrays.h ------------------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLD_ARRAYS_H
0010 #define LLD_ARRAYS_H
0011 
0012 #include "llvm/ADT/ArrayRef.h"
0013 
0014 #include <vector>
0015 
0016 namespace lld {
0017 // Split one uint8 array into small pieces of uint8 arrays.
0018 inline std::vector<llvm::ArrayRef<uint8_t>> split(llvm::ArrayRef<uint8_t> arr,
0019                                                   size_t chunkSize) {
0020   std::vector<llvm::ArrayRef<uint8_t>> ret;
0021   while (arr.size() > chunkSize) {
0022     ret.push_back(arr.take_front(chunkSize));
0023     arr = arr.drop_front(chunkSize);
0024   }
0025   if (!arr.empty())
0026     ret.push_back(arr);
0027   return ret;
0028 }
0029 
0030 } // namespace lld
0031 
0032 #endif