[llvm] [SYCL][LLVM] Adding property set I/O library for SYCL (PR #110771)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 3 01:11:27 PDT 2024
================
@@ -90,3 +90,180 @@ llvm::Error llvm::decodeBase64(llvm::StringRef Input,
}
return Error::success();
}
+
+using namespace llvm;
+
+namespace {
+
+using byte = std::byte;
+
+::llvm::Error makeError(const Twine &Msg) {
+ return createStringError(std::error_code{}, Msg);
+}
+
+class Base64Impl {
+private:
+ static constexpr char EncodingTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz"
+ "0123456789+/";
+
+ static_assert(sizeof(EncodingTable) == 65, "");
+
+ // Compose an index into the encoder table from two bytes and the number of
+ // significant bits in the lower byte until the byte boundary.
+ static inline int composeInd(byte ByteLo, byte ByteHi, int BitsLo) {
+ int Res = (int)((ByteHi << BitsLo) | (ByteLo >> (8 - BitsLo))) & 0x3F;
+ return Res;
+ }
+
+ // Decode a single character.
+ static inline int decode(char Ch) {
+ if (Ch >= 'A' && Ch <= 'Z') // 0..25
+ return Ch - 'A';
+ else if (Ch >= 'a' && Ch <= 'z') // 26..51
----------------
arsenm wrote:
No else after return
https://github.com/llvm/llvm-project/pull/110771
More information about the llvm-commits
mailing list