Loading [MathJax]/extensions/tex2jax.js
CIRCT
20.0.0git
Toggle main menu visibility
Main Page
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
Variables
_
a
b
c
d
e
f
g
i
k
l
m
n
o
r
s
t
v
w
Typedefs
a
b
c
d
e
f
g
h
i
m
o
p
r
s
t
w
Enumerations
Enumerator
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
~
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
x
z
~
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Typedefs
a
b
c
d
e
f
g
i
k
l
m
n
o
p
r
s
t
u
v
Enumerations
Enumerator
a
b
c
d
f
i
m
n
o
p
r
s
t
u
v
w
x
z
Related Symbols
Files
File List
File Members
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
y
z
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
y
z
Variables
c
e
g
i
l
m
n
p
r
s
t
w
Typedefs
b
c
d
e
f
h
i
j
l
m
n
o
p
s
u
v
Enumerations
Enumerator
a
c
d
f
h
i
n
o
Macros
a
c
d
e
g
h
i
r
s
t
v
x
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Loading...
Searching...
No Matches
lib
Dialect
ESI
runtime
cpp
lib
Utils.cpp
Go to the documentation of this file.
1
//===- Utils.cpp - implementations ESI utility code -----------------------===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// DO NOT EDIT!
10
// This file is distributed as part of an ESI package. The source for this file
11
// should always be modified within CIRCT
12
// (lib/dialect/ESI/runtime/cpp/lib/backends/Cosim.cpp).
13
//
14
//===----------------------------------------------------------------------===//
15
16
#include "
esi/Utils.h
"
17
18
static
constexpr
char
Table
[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
19
"abcdefghijklmnopqrstuvwxyz"
20
"0123456789+/"
;
21
22
// Copied then modified slightly from llvm/lib/Support/Base64.cpp.
23
void
esi::utils::encodeBase64
(
const
void
*dataIn,
size_t
size,
24
std::string &buffer) {
25
const
char
*data =
static_cast<
const
char
*
>
(dataIn);
26
buffer.resize(((size + 2) / 3) * 4);
27
28
size_t
i = 0, j = 0;
29
for
(
size_t
n = size / 3 * 3; i < n; i += 3, j += 4) {
30
uint32_t x = ((
unsigned
char)data[i] << 16) |
31
((
unsigned
char)data[i + 1] << 8) | (
unsigned
char)data[i + 2];
32
buffer[j + 0] =
Table
[(x >> 18) & 63];
33
buffer[j + 1] =
Table
[(x >> 12) & 63];
34
buffer[j + 2] =
Table
[(x >> 6) & 63];
35
buffer[j + 3] =
Table
[x & 63];
36
}
37
if
(i + 1 == size) {
38
uint32_t x = ((
unsigned
char)data[i] << 16);
39
buffer[j + 0] =
Table
[(x >> 18) & 63];
40
buffer[j + 1] =
Table
[(x >> 12) & 63];
41
buffer[j + 2] =
'='
;
42
buffer[j + 3] =
'='
;
43
}
else
if
(i + 2 == size) {
44
uint32_t x =
45
((
unsigned
char)data[i] << 16) | ((
unsigned
char)data[i + 1] << 8);
46
buffer[j + 0] =
Table
[(x >> 18) & 63];
47
buffer[j + 1] =
Table
[(x >> 12) & 63];
48
buffer[j + 2] =
Table
[(x >> 6) & 63];
49
buffer[j + 3] =
'='
;
50
}
51
}
23
void
esi::utils::encodeBase64
(
const
void
*dataIn,
size_t
size, {
…
}
Table
static constexpr char Table[]
Definition
Utils.cpp:18
Utils.h
esi::utils::encodeBase64
void encodeBase64(const void *data, size_t size, std::string &out)
Definition
Utils.cpp:23
Generated on Mon Jan 13 2025 00:08:31 for CIRCT by
1.9.8