repo_name string | dataset string | owner string | lang string | func_name string | code string | docstring string | url string | sha string |
|---|---|---|---|---|---|---|---|---|
BugChecker | github_2023 | vitoplantamura | c | ZydisCompareRequestToInstruction | void ZydisCompareRequestToInstruction(const ZydisEncoderRequest *request,
const ZydisDecodedInstruction *insn, const ZydisDecodedOperand* operands, const ZyanU8 *insn_bytes)
{
// Special case, `xchg rAX, rAX` is an alias for `NOP`
if ((request->mnemonic == ZYDIS_MNEMONIC_XCHG) &&
(request->operand_c... | /* ============================================================================================== */
/* Fuzz target */
/* ============================================================================================== */
// TODO: This cou... | https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/tools/ZydisFuzzEncoder.c#L40-L200 | 8b81e76efe457b59be3a6e752efd43916ba0cabb |
BugChecker | github_2023 | vitoplantamura | c | ZydisStdinRead | ZyanUSize ZydisStdinRead(void *ctx, ZyanU8* buf, ZyanUSize max_len)
{
ZYAN_UNUSED(ctx);
return fread(buf, 1, max_len, ZYAN_STDIN);
} | /* ============================================================================================== */
/* Stream reading abstraction */
/* ============================================================================================== */ | https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/tools/ZydisFuzzShared.c#L46-L50 | 8b81e76efe457b59be3a6e752efd43916ba0cabb |
BugChecker | github_2023 | vitoplantamura | c | ZydisValidateEnumRanges | void ZydisValidateEnumRanges(const ZydisDecodedInstruction* insn,
const ZydisDecodedOperand* operands, ZyanU8 operand_count)
{
# define ZYDIS_CHECK_ENUM(value, max) \
if ((ZyanU64)(value) > (ZyanU64)(max)) ... | // NOTE: This function doesn't validate flag values, yet. | https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/tools/ZydisFuzzShared.c#L129-L196 | 8b81e76efe457b59be3a6e752efd43916ba0cabb |
BugChecker | github_2023 | vitoplantamura | c | ZydisFuzzerInit | int ZydisFuzzerInit()
{
if (ZydisGetVersion() != ZYDIS_VERSION)
{
fputs("Invalid Zydis version\n", ZYAN_STDERR);
return EXIT_FAILURE;
}
#ifdef ZYAN_WINDOWS
// The `stdin` pipe uses text-mode on Windows platforms by default. We need it to be opened in
// binary mode
(void)_setmod... | /* ============================================================================================== */
/* Entry point */
/* ============================================================================================== */ | https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/tools/ZydisFuzzShared.c#L399-L414 | 8b81e76efe457b59be3a6e752efd43916ba0cabb |
BugChecker | github_2023 | vitoplantamura | c | main | int main(void)
{
if (ZydisFuzzerInit() != EXIT_SUCCESS)
{
return EXIT_FAILURE;
}
#ifdef ZYDIS_FUZZ_AFL_FAST
while (__AFL_LOOP(1000))
{
ZydisFuzzTarget(&ZydisStdinRead, ZYAN_NULL);
}
return EXIT_SUCCESS;
#else
return ZydisFuzzTarget(&ZydisStdinRead, ZYAN_NULL);
#endif
} | // !ZYDIS_LIBFUZZER | https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/tools/ZydisFuzzShared.c#L447-L463 | 8b81e76efe457b59be3a6e752efd43916ba0cabb |
BugChecker | github_2023 | vitoplantamura | c | PrintStatusError | static void PrintStatusError(ZyanStatus status, const char* message)
{
ZYAN_ASSERT(ZYAN_FAILED(status));
if (ZYAN_STATUS_MODULE(status) >= ZYAN_MODULE_USER)
{
ZYAN_FPRINTF(ZYAN_STDERR,
"%s%s: User defined status code [0x%" PRIx32 "]%s\n",
CVT100_ERR(COLOR_ERROR), message, st... | /* ---------------------------------------------------------------------------------------------- */
/* Text output */
/* ---------------------------------------------------------------------------------------------- */
/**
* Prints the... | https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/tools/ZydisInfo.c#L200-L217 | 8b81e76efe457b59be3a6e752efd43916ba0cabb |
BugChecker | github_2023 | vitoplantamura | c | PrintSectionHeader | static void PrintSectionHeader(const char* name)
{
ZYAN_ASSERT(ZYAN_STRLEN(name) <= 8);
ZYAN_PRINTF("%s== [ %s%8s%s ] ==============================================================" \
"==============================%s\n",
CVT100_OUT(COLOR_HEADER), CVT100_OUT(COLOR_HEADER_TITLE), name, CVT100_OUT... | /**
* Prints a section header.
*
* @param name The section name.
*/ | https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/tools/ZydisInfo.c#L224-L231 | 8b81e76efe457b59be3a6e752efd43916ba0cabb |
BugChecker | github_2023 | vitoplantamura | c | PrintValueLabel | static void PrintValueLabel(const char* name)
{
ZYAN_ASSERT(ZYAN_STRLEN(name) <= 11);
ZYAN_PRINTF("%s%11s:%s ", CVT100_OUT(COLOR_VALUE_LABEL), name, CVT100_OUT(COLOR_DEFAULT));
} | /**
* Prints a value label.
*
* @param name The value name.
*/ | https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/tools/ZydisInfo.c#L238-L242 | 8b81e76efe457b59be3a6e752efd43916ba0cabb |
BugChecker | github_2023 | vitoplantamura | c | PrintSegments | static void PrintSegments(const ZydisDecodedInstruction* instruction, const ZyanU8* buffer,
ZyanBool print_hints)
{
ZydisInstructionSegments segments;
ZydisGetInstructionSegments(instruction, &segments);
struct
{
ZyanU8 pos;
const char* color;
const char* name;
} print_i... | /* ---------------------------------------------------------------------------------------------- */
/* ============================================================================================== */
/* Print functions */
/* ==============... | https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/tools/ZydisInfo.c#L293-L428 | 8b81e76efe457b59be3a6e752efd43916ba0cabb |
BugChecker | github_2023 | vitoplantamura | c | PrintSizeOptimizedForm | static void PrintSizeOptimizedForm(const ZydisDecoder* decoder,
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operands,
ZyanU8 operand_count)
{
ZydisEncoderRequest request;
ZyanStatus status = ZydisEncoderDecodedInstructionToEncoderRequest(instruction, operands,
operand_... | /**
* Prints a size optimized form of the input instruction.
*
* @param decoder A pointer to the `ZydisDecoder` instance.
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
* @param operands A pointer to the `operands` array.
* @param operand_count The length of the `operands` ar... | https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/tools/ZydisInfo.c#L438-L469 | 8b81e76efe457b59be3a6e752efd43916ba0cabb |
BugChecker | github_2023 | vitoplantamura | c | PrintOperands | static void PrintOperands(const ZydisDecodedInstruction* instruction,
const ZydisDecodedOperand* operands)
{
PrintSectionHeader("OPERANDS");
ZYAN_PRINTF("%s## TYPE VISIBILITY ACTION ENCODING SIZE NELEM ELEMSZ ELEMTY" \
"PE VALUE%s\n", CVT100_OUT(COLOR_HEADER)... | /**
* Prints instruction operands info.
*
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
* @param operands A pointer to the first `ZydisDecodedOperand` struct of the instruction.
*/ | https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/tools/ZydisInfo.c#L477-L687 | 8b81e76efe457b59be3a6e752efd43916ba0cabb |
BugChecker | github_2023 | vitoplantamura | c | PrintFlags | static void PrintFlags(const ZydisDecodedInstruction* instruction)
{
static const char* strings_cpu_flags[] =
{
"CF",
ZYAN_NULL,
"PF",
ZYAN_NULL,
"AF",
ZYAN_NULL,
"ZF",
"SF",
"TF",
"IF",
"DF",
"OF",
"IOPL",
... | /**
* Prints instruction flags info.
*
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
*/ | https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/tools/ZydisInfo.c#L694-L785 | 8b81e76efe457b59be3a6e752efd43916ba0cabb |
BugChecker | github_2023 | vitoplantamura | c | PrintAVXInfo | static void PrintAVXInfo(const ZydisDecodedInstruction* instruction)
{
static const char* strings_broadcast_mode[] =
{
"NONE",
"1_TO_2",
"1_TO_4",
"1_TO_8",
"1_TO_16",
"1_TO_32",
"1_TO_64",
"2_TO_4",
"2_TO_8",
"2_TO_16",
"4_... | /**
* Prints instruction AVX info.
*
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
*/ | https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/tools/ZydisInfo.c#L792-L888 | 8b81e76efe457b59be3a6e752efd43916ba0cabb |
BugChecker | github_2023 | vitoplantamura | c | PrintTokenizedInstruction | static void PrintTokenizedInstruction(const ZydisFormatterToken* token)
{
ZyanStatus status = ZYAN_STATUS_SUCCESS;
while (ZYAN_SUCCESS(status))
{
ZydisTokenType type;
ZyanConstCharPointer value;
if (!ZYAN_SUCCESS(status = ZydisFormatterTokenGetValue(token, &type, &value)))
{
... | /**
* Prints the tokenized instruction.
*
* @param token A pointer to the first token.
*/ | https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/tools/ZydisInfo.c#L895-L948 | 8b81e76efe457b59be3a6e752efd43916ba0cabb |
BugChecker | github_2023 | vitoplantamura | c | PrintDisassembly | static void PrintDisassembly(const ZydisDecodedInstruction* instruction,
const ZydisDecodedOperand* operands, ZydisFormatterStyle style)
{
ZyanStatus status;
ZydisFormatter formatter;
switch (style)
{
case ZYDIS_FORMATTER_STYLE_ATT:
if (!ZYAN_SUCCESS(status = ZydisFormatterInit(&formatt... | /**
* Prints the formatted instruction disassembly.
*
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
* @param operands A pointer to the first `ZydisDecodedOperand` struct of the instruction.
* @param style The formatter style.
*/ | https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/tools/ZydisInfo.c#L957-L1009 | 8b81e76efe457b59be3a6e752efd43916ba0cabb |
BugChecker | github_2023 | vitoplantamura | c | PrintInstruction | static void PrintInstruction(const ZydisDecoder* decoder,
const ZydisDecodedInstruction* instruction, const ZydisDecodedOperand* operands)
{
static const char* opcode_maps[] =
{
"DEFAULT",
"0F",
"0F38",
"0F3A",
"MAP4",
"MAP5",
"MAP6",
"MAP7",
... | /**
* Dumps basic instruction info.
*
* @param decoder A pointer to the `ZydisDecoder` instance.
* @param instruction A pointer to the `ZydisDecodedInstruction` struct.
* @param operands A pointer to the first `ZydisDecodedOperand` struct of the instruction.
*/ | https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/tools/ZydisInfo.c#L1018-L1227 | 8b81e76efe457b59be3a6e752efd43916ba0cabb |
BugChecker | github_2023 | vitoplantamura | c | PrintUsage | void PrintUsage(int argc, char *argv[])
{
ZYAN_FPRINTF(ZYAN_STDERR, "%sUsage: %s <machine_mode> [stack_width] <hexbytes>\n\n"
"Machine mode: -real|-16|-32|-64\n"
"Stack width: -16|-32|-64%s\n",
CVT100_ERR(COLOR_ERROR), (argc > 0 ? argv[0... | /* ============================================================================================== */
/* Entry point */
/* ============================================================================================== */ | https://github.com/vitoplantamura/BugChecker/blob/8b81e76efe457b59be3a6e752efd43916ba0cabb/dependencies/zydis/tools/ZydisInfo.c#L1233-L1240 | 8b81e76efe457b59be3a6e752efd43916ba0cabb |
night-owl.nvim | github_2023 | oxfist | c | printFooBar | void printFooBar(FooBar foobar) {
printf("Foo: %s, Bar: %d\n", foobar.foo, foobar.bar);
} | // Function | https://github.com/oxfist/night-owl.nvim/blob/86ed124c2f7e118670649701288e024444bf91e5/samples/sample.c#L11-L13 | 86ed124c2f7e118670649701288e024444bf91e5 |
night-owl.nvim | github_2023 | oxfist | c | printArray | void printArray(int arr[], int size) {
for(int i = 0; i < size; i++) {
printf("%d ", arr[i]);
}
printf("\n");
} | // Loop | https://github.com/oxfist/night-owl.nvim/blob/86ed124c2f7e118670649701288e024444bf91e5/samples/sample.c#L19-L24 | 86ed124c2f7e118670649701288e024444bf91e5 |
night-owl.nvim | github_2023 | oxfist | c | swap | void swap(int* a, int* b) {
int temp = *a;
*a = *b;
*b = temp;
} | // Pointers | https://github.com/oxfist/night-owl.nvim/blob/86ed124c2f7e118670649701288e024444bf91e5/samples/sample.c#L27-L31 | 86ed124c2f7e118670649701288e024444bf91e5 |
dynamicgo | github_2023 | cloudwego | c | atof_eisel_lemire64 | bool atof_eisel_lemire64(uint64_t mant, int exp10, int sgn, double *val)
{
if (exp10 < -348 || exp10 > 347)
{
return false;
}
/* Calculate the 2-base exponent of float */
int clz = count_leading_zeroes_u64(mant);
mant <<= clz;
/* lg10/lg2 ≈ 217706>>16 */
uint64_t ret_exp2 = ((ui... | /* This is Eisel Lemire ParseFloat algorithm implemented in C.
* reference: https://nigeltao.github.io/blog/2020/eisel-lemire.html
*/ | https://github.com/cloudwego/dynamicgo/blob/d58b94fc7d71935c30f4716517e1d392149e2666/native/atof_eisel_lemire.c#L74-L161 | d58b94fc7d71935c30f4716517e1d392149e2666 |
dynamicgo | github_2023 | cloudwego | c | trim | static inline void trim(Decimal *d) {
while (d->nd > 0 && d->d[d->nd - 1] == '0') {
d->nd--;
}
if (d->nd == 0) {
d->dp = 0;
}
} | /* trim trailing zeros from number */ | https://github.com/cloudwego/dynamicgo/blob/d58b94fc7d71935c30f4716517e1d392149e2666/native/atof_native.c#L130-L137 | d58b94fc7d71935c30f4716517e1d392149e2666 |
dynamicgo | github_2023 | cloudwego | c | right_shift | static inline void right_shift(Decimal *d, uint32_t k) {
int r = 0; // read pointer
int w = 0; // write pointer
uint64_t n = 0;
/* Pick up enough leading digits to cover first shift */
for (; n >> k == 0; r++) {
if (r >= d->nd) {
if (n == 0) {
d->nd = 0... | /* Binary shift right (/ 2) by k bits. k <= maxShift to avoid overflow */ | https://github.com/cloudwego/dynamicgo/blob/d58b94fc7d71935c30f4716517e1d392149e2666/native/atof_native.c#L140-L190 | d58b94fc7d71935c30f4716517e1d392149e2666 |
dynamicgo | github_2023 | cloudwego | c | prefix_is_less | static inline bool prefix_is_less(const char *b, const char *s, uint64_t bn) {
int i = 0;
for (; i < bn; i++) {
if (s[i] == '\0') {
return false;
}
if (b[i] != s[i]) {
return b[i] < s[i];
}
}
return s[i] != '\0';
} | /* Compare the leading prefix, if b is lexicographically less, return 0 */ | https://github.com/cloudwego/dynamicgo/blob/d58b94fc7d71935c30f4716517e1d392149e2666/native/atof_native.c#L193-L204 | d58b94fc7d71935c30f4716517e1d392149e2666 |
dynamicgo | github_2023 | cloudwego | c | left_shift | static inline void left_shift(Decimal *d, uint32_t k) {
int delta = LSHIFT_TAB[k].delta;
if (prefix_is_less(d->d, LSHIFT_TAB[k].cutoff, d->nd)){
delta--;
}
int r = d->nd; // read index
int w = d->nd + delta; // write index
uint64_t n = 0;
uint64_t quo = 0;
uint64_t rem ... | /* Binary shift left (* 2) by k bits. k <= maxShift to avoid overflow */ | https://github.com/cloudwego/dynamicgo/blob/d58b94fc7d71935c30f4716517e1d392149e2666/native/atof_native.c#L207-L255 | d58b94fc7d71935c30f4716517e1d392149e2666 |
dynamicgo | github_2023 | cloudwego | c | rounded_integer | static inline uint64_t rounded_integer(Decimal *d) {
if (d->dp > 20) { // overflow
return 0xFFFFFFFFFFFFFFFF; //64 bits
}
int i = 0;
uint64_t n = 0;
for (i = 0; i < d->dp && i < d->nd; i++) {
n = n * 10 + (d->d[i] - '0');
}
for (; i < d->dp; i++) {
n *= 10;
}
... | /* Extract integer part, rounded appropriately */ | https://github.com/cloudwego/dynamicgo/blob/d58b94fc7d71935c30f4716517e1d392149e2666/native/atof_native.c#L302-L319 | d58b94fc7d71935c30f4716517e1d392149e2666 |
dynamicgo | github_2023 | cloudwego | c | b64encode | void b64encode(GoSlice *out, const GoSlice *src, int mode)
{
char *ob = out->buf + out->len;
char *op = out->buf + out->len;
const char *ip = src->buf;
const char *ie = src->buf + src->len;
const char *st = TabEncodeCharsetStd;
const uint8_t *vt = VecEncodeCharsetStd;
/* check for empty str... | /** Function Implementations **/ | https://github.com/cloudwego/dynamicgo/blob/d58b94fc7d71935c30f4716517e1d392149e2666/native/base64.c#L173-L313 | d58b94fc7d71935c30f4716517e1d392149e2666 |
dynamicgo | github_2023 | cloudwego | c | decode_block | static inline int64_t decode_block(
const uint8_t *ie,
const uint8_t **ipp,
char **opp,
const uint8_t *tab,
int mode)
{
int nb = 0;
uint32_t v0 = 0;
/* buffer pointers */
char *op = *opp;
const uint8_t *ip = *ipp;
/* load up to 4 characters */
while (nb < 4 && ip < ie)
... | /* Return 0 if success, otherwise return the error position + 1 */ | https://github.com/cloudwego/dynamicgo/blob/d58b94fc7d71935c30f4716517e1d392149e2666/native/base64.c#L539-L657 | d58b94fc7d71935c30f4716517e1d392149e2666 |
dynamicgo | github_2023 | cloudwego | c | f64todec | static inline f64_dec f64todec(uint64_t rsig, int32_t rexp, uint64_t c, int32_t q) {
uint64_t cbl, cb, cbr, vbl, vb, vbr, lower, upper, s;
int32_t k, h;
bool even, irregular, w_inside, u_inside;
f64_dec dec;
even = !(c & 1);
irregular = rsig == 0 && rexp > 1;
cbl = 4 * c - 2 + irregular;
... | /**
Rendering float point number into decimal.
The function used Schubfach algorithm, reference:
The Schubfach way to render doubles, Raffaello Giulietti, 2022-03-20.
https://drive.google.com/file/d/1gp5xv4CAa78SVgCeWfGqqI4FfYYYuNFb
https://mail.openjdk.java.net/pipermail/core-libs-dev/2021-November/083536.html
h... | https://github.com/cloudwego/dynamicgo/blob/d58b94fc7d71935c30f4716517e1d392149e2666/native/fastfloat.c#L288-L347 | d58b94fc7d71935c30f4716517e1d392149e2666 |
dynamicgo | github_2023 | cloudwego | c | _mm_cchars_mask | static inline int _mm_cchars_mask(__m128i v)
{
__m128i e1 = _mm_cmpgt_epi8(v, _mm_set1_epi8(-1));
__m128i e2 = _mm_cmpgt_epi8(v, _mm_set1_epi8(31));
return _mm_movemask_epi8(_mm_andnot_si128(e2, e1));
} | // contrl char: 0x00 ~ 0x1F | https://github.com/cloudwego/dynamicgo/blob/d58b94fc7d71935c30f4716517e1d392149e2666/native/scanning.c#L383-L388 | d58b94fc7d71935c30f4716517e1d392149e2666 |
dynamicgo | github_2023 | cloudwego | c | _mm256_cchars_mask | static inline int _mm256_cchars_mask(__m256i v)
{
__m256i e1 = _mm256_cmpgt_epi8(v, _mm256_set1_epi8(-1));
__m256i e2 = _mm256_cmpgt_epi8(v, _mm256_set1_epi8(31));
return _mm256_movemask_epi8(_mm256_andnot_si256(e2, e1));
} | // contrl char: 0x00 ~ 0x1F | https://github.com/cloudwego/dynamicgo/blob/d58b94fc7d71935c30f4716517e1d392149e2666/native/scanning.c#L398-L403 | d58b94fc7d71935c30f4716517e1d392149e2666 |
dynamicgo | github_2023 | cloudwego | c | value | long value(const char *s, size_t n, long p, JsonState *ret, int allow_control)
{
long q = p;
GoString m = {.buf = s, .len = n};
/* parse the next identifier, q is UNSAFE, may cause out-of-bounds accessing */
switch (advance_ns(&m, &q))
{
case '-': /* fallthrough */
case '0': /* fallthrough ... | /** Value Scanning Routines **/ | https://github.com/cloudwego/dynamicgo/blob/d58b94fc7d71935c30f4716517e1d392149e2666/native/scanning.c#L667-L725 | d58b94fc7d71935c30f4716517e1d392149e2666 |
dynamicgo | github_2023 | cloudwego | c | check_eof | init_ret(V_INTEGER) \
check_eof() \
check_sign(on_neg) \
\
/* check for leading zero or any digits */ \
check_digit() \
... | /* initialize the result, and check for '-' */ | https://github.com/cloudwego/dynamicgo/blob/d58b94fc7d71935c30f4716517e1d392149e2666/native/scanning.c | d58b94fc7d71935c30f4716517e1d392149e2666 |
dynamicgo | github_2023 | cloudwego | c | is_atof_exact | static inline bool is_atof_exact(uint64_t man, int exp, int sgn, double *val)
{
*val = (double)man;
if (man >> 52 != 0)
{
return false;
}
/* equal to if (sgn == -1) { *val *= -1; } */
*(uint64_t *)val |= ((uint64_t)(sgn) >> 63 << 63);
if (exp == 0 || man == 0)
{
return... | /** check whether float can represent the val exactly **/ | https://github.com/cloudwego/dynamicgo/blob/d58b94fc7d71935c30f4716517e1d392149e2666/native/scanning.c#L883-L926 | d58b94fc7d71935c30f4716517e1d392149e2666 |
dynamicgo | github_2023 | cloudwego | c | check_eof | init_ret(V_INTEGER)
check_eof()
check_sign(sgn = -1)
/* check for leading zero */
check_digit()
check_leading_zero()
/* parse the integer part */
while (i < n && is_digit(s[i]))
{
add_integer_to_mantissa(man, man_nd, exp10, (s[i] - '0'))
... | /* initialize the result, and check for EOF */ | https://github.com/cloudwego/dynamicgo/blob/d58b94fc7d71935c30f4716517e1d392149e2666/native/scanning.c#L975-L1002 | d58b94fc7d71935c30f4716517e1d392149e2666 |
dynamicgo | github_2023 | cloudwego | c | fsm_exec | static inline long fsm_exec(StateMachine *self, const GoString *src, long *p, int validate_flag)
{
int vt;
char ch;
long vi = -1;
/* run until no more nested values */
while (self->sp)
{
ch = advance_ns(src, p);
vt = self->vt[self->sp - 1];
/* set the start address if a... | /** Value Skipping FSM **/
// static inline void FSM_INIT(StateMachine *self, int vt)
// {
// self->sp = 1;
// self->vt[0] = vt;
// }
// static inline long fsm_push(StateMachine *self, int vt)
// {
// if (self->sp >= MAX_RECURSE)
// {
// return -ERR_RECURSE_MAX;
// }
// else
// {
// ... | https://github.com/cloudwego/dynamicgo/blob/d58b94fc7d71935c30f4716517e1d392149e2666/native/scanning.c#L1134-L1315 | d58b94fc7d71935c30f4716517e1d392149e2666 |
dynamicgo | github_2023 | cloudwego | c | check_bits | check_bits(md)
check_bits(me)
check_bits(ms)
check_vidx(di, md)
check_vidx(ei, me)
check_vidx(si, ms)
/* check for valid number */
if (i != 32)
{
... | /* check & update decimal point, exponent and sign index */ | https://github.com/cloudwego/dynamicgo/blob/d58b94fc7d71935c30f4716517e1d392149e2666/native/scanning.c#L1385-L1398 | d58b94fc7d71935c30f4716517e1d392149e2666 |
dynamicgo | github_2023 | cloudwego | c | check_bits | check_bits(md)
check_bits(me)
check_bits(ms)
check_vidx(di, md)
check_vidx(ei, me)
check_vidx(si, ms)
/* check for valid number */
if (i != 16)
{
... | /* check & update exponent and sign index */ | https://github.com/cloudwego/dynamicgo/blob/d58b94fc7d71935c30f4716517e1d392149e2666/native/scanning.c#L1458-L1470 | d58b94fc7d71935c30f4716517e1d392149e2666 |
dynamicgo | github_2023 | cloudwego | c | _mm_ascii_mask | static inline int _mm_ascii_mask(__m128i vv)
{
return _mm_movemask_epi8(vv);
} | // ascii: 0x00 ~ 0x7F | https://github.com/cloudwego/dynamicgo/blob/d58b94fc7d71935c30f4716517e1d392149e2666/native/utf8.c#L21-L24 | d58b94fc7d71935c30f4716517e1d392149e2666 |
dynamicgo | github_2023 | cloudwego | c | _mm256_ascii_mask | static inline int _mm256_ascii_mask(__m256i vv)
{
return _mm256_movemask_epi8(vv);
} | // ascii: 0x00 ~ 0x7F | https://github.com/cloudwego/dynamicgo/blob/d58b94fc7d71935c30f4716517e1d392149e2666/native/utf8.c#L29-L32 | d58b94fc7d71935c30f4716517e1d392149e2666 |
dynamicgo | github_2023 | cloudwego | c | nonascii_is_utf8 | static inline ssize_t nonascii_is_utf8(const uint8_t *sp, size_t n)
{
uint8_t mask = first[sp[0]];
uint8_t size = mask & 7;
if (n < size)
{
return 0;
}
struct AcceptRange accept = ranges[mask >> 4];
switch (size)
{
case 4:
if (sp[3] < locb || hicb < sp[3])
... | // UTF-8 code point | first byte | second byte | third byte | fourth byte
// U+0000 - U+007F | 0___ ____
// U+0080 - U+07FF | 110_ ____ | 10__ ____
// U+0800 - U+D7FF | 1110 ____ | 10__ ____ | 10__ ____
// U+D800 - U+DFFF | reserved for UTF-16 surrogate pairs
// U+E000 - U+FFFF | 1110 ____ | 10__ ... | https://github.com/cloudwego/dynamicgo/blob/d58b94fc7d71935c30f4716517e1d392149e2666/native/utf8.c#L101-L130 | d58b94fc7d71935c30f4716517e1d392149e2666 |
dynamicgo | github_2023 | cloudwego | c | utf8_validate | ssize_t utf8_validate(const char *sp, ssize_t nb)
{
const uint8_t *p = (const uint8_t *)sp;
const uint8_t *s = (const uint8_t *)sp;
ssize_t n;
ssize_t b;
// Optimize for the continuous non-ascii chars */
while (nb > 0 && (n = (!is_ascii(*p) ? 0 : find_non_ascii(p, nb))) != -1)
{
/* ... | // utf8_validate validates whether the JSON string is valid UTF-8.
// return -1 if validate, otherwise, return the error postion. | https://github.com/cloudwego/dynamicgo/blob/d58b94fc7d71935c30f4716517e1d392149e2666/native/utf8.c#L183-L213 | d58b94fc7d71935c30f4716517e1d392149e2666 |
rp2040-psram | github_2023 | polpo | c | psram_spi_init_clkdiv | psram_spi_inst_t psram_spi_init_clkdiv(PIO pio, int sm, float clkdiv, bool fudge) {
psram_spi_inst_t spi;
spi.pio = pio;
spi.offset = pio_add_program(spi.pio, fudge ? &spi_psram_fudge_program : &spi_psram_program);
if (sm == -1) {
spi.sm = pio_claim_unused_sm(spi.pio, true);
} else {
... | // defined(PSRAM_ASYNC) && defined(PSRAM_ASYNC_SYNCHRONIZE) | https://github.com/polpo/rp2040-psram/blob/febdaf81ac638d711c6ec9efa410d45d20ba9fe9/psram_spi.c | febdaf81ac638d711c6ec9efa410d45d20ba9fe9 |
LeetCode_DailyChallenge_2023 | github_2023 | 7oSkaaa | c | compare_ints | int compare_ints(const int *a, const int *b) {
return *a - *b;
} | // Author: Ahmed Gamal
// for this problem we need to sort the array first then check if the difference between each two adjacent elements is the same
// if it is the same then we return true else we return false
// compare function for qsort | https://github.com/7oSkaaa/LeetCode_DailyChallenge_2023/blob/e00960b9f5cbfaf813572c366e16d4fef5fa6b8d/06- June/06- Can Make Arithmetic Progression From Sequence/06- Can Make Arithmetic Progression From Sequence (Ahmed Gamal).c#L7-L9 | e00960b9f5cbfaf813572c366e16d4fef5fa6b8d |
Whisper | github_2023 | Const-me | c | LZ4_read16 | static U16 LZ4_read16(const void* memPtr) { return *(const U16*) memPtr; } | /* lie to the compiler about data alignment; use with caution */ | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/Utils/LZ4/lz4.c#L371-L371 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | LZ4_read16 | static U16 LZ4_read16(const void* memPtr)
{
U16 val; LZ4_memcpy(&val, memPtr, sizeof(val)); return val;
} | /* safe and portable access using memcpy() */ | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/Utils/LZ4/lz4.c#L393-L396 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | LZ4_wildCopy32 | LZ4_FORCE_INLINE void
LZ4_wildCopy32(void* dstPtr, const void* srcPtr, void* dstEnd)
{
BYTE* d = (BYTE*)dstPtr;
const BYTE* s = (const BYTE*)srcPtr;
BYTE* const e = (BYTE*)dstEnd;
do { LZ4_memcpy(d,s,16); LZ4_memcpy(d+16,s+16,16); d+=32; s+=32; } while (d<e);
} | /* customized variant of memcpy, which can overwrite up to 32 bytes beyond dstEnd
* this version copies two times 16 bytes (instead of one time 32 bytes)
* because it must be compatible with offsets >= 16. */ | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/Utils/LZ4/lz4.c#L500-L508 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | LZ4_memcpy_using_offset | LZ4_FORCE_INLINE void
LZ4_memcpy_using_offset(BYTE* dstPtr, const BYTE* srcPtr, BYTE* dstEnd, const size_t offset)
{
BYTE v[8];
assert(dstEnd >= dstPtr + MINMATCH);
switch(offset) {
case 1:
MEM_INIT(v, *srcPtr, 8);
break;
case 2:
LZ4_memcpy(v, srcPtr, 2);
LZ4_memcpy... | /* LZ4_memcpy_using_offset() presumes :
* - dstEnd >= dstPtr + MINMATCH
* - there is at least 8 bytes available to write after dstEnd */ | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/Utils/LZ4/lz4.c#L513-L551 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | LZ4_decompress_safe | LZ4_FORCE_O2
int LZ4_decompress_safe(const char* source, char* dest, int compressedSize, int maxDecompressedSize)
{
return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize,
decode_full_block, noDict,
(BYTE*)dest, NULL, 0);
} | /*===== Instantiate the API decoding functions. =====*/ | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/Utils/LZ4/lz4.c#L2344-L2350 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | LZ4_decompress_safe_withPrefix64k | LZ4_FORCE_O2 /* Exported, an obsolete API function. */
int LZ4_decompress_safe_withPrefix64k(const char* source, char* dest, int compressedSize, int maxOutputSize)
{
return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize,
decode_full_block, withPrefix64k,
... | /*===== Instantiate a few more decoding cases, used more than once. =====*/ | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/Utils/LZ4/lz4.c#L2372-L2378 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | LZ4_decompress_fast_withPrefix64k | int LZ4_decompress_fast_withPrefix64k(const char* source, char* dest, int originalSize)
{
return LZ4_decompress_unsafe_generic(
(const BYTE*)source, (BYTE*)dest, originalSize,
64 KB, NULL, 0);
} | /* Another obsolete API function, paired with the previous one. */ | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/Utils/LZ4/lz4.c#L2390-L2395 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | LZ4_decompress_safe_doubleDict | LZ4_FORCE_INLINE
int LZ4_decompress_safe_doubleDict(const char* source, char* dest, int compressedSize, int maxOutputSize,
size_t prefixSize, const void* dictStart, size_t dictSize)
{
return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize,
... | /* The "double dictionary" mode, for use with e.g. ring buffers: the first part
* of the dictionary is passed as prefix, and the second via dictStart + dictSize.
* These routines are used only once, in LZ4_decompress_*_continue().
*/ | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/Utils/LZ4/lz4.c#L2450-L2457 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | LZ4_setStreamDecode | int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode, const char* dictionary, int dictSize)
{
LZ4_streamDecode_t_internal* lz4sd = &LZ4_streamDecode->internal_donotuse;
lz4sd->prefixSize = (size_t)dictSize;
if (dictSize) {
assert(dictionary != NULL);
lz4sd->prefixEnd = (const BYTE*)... | /*! LZ4_setStreamDecode() :
* Use this function to instruct where to find the dictionary.
* This function is not necessary if previous data is still available where it was decoded.
* Loading a size of 0 is allowed (same effect as no dictionary).
* @return : 1 if OK, 0 if error
*/ | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/Utils/LZ4/lz4.c#L2482-L2495 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | LZ4_decoderRingBufferSize | int LZ4_decoderRingBufferSize(int maxBlockSize)
{
if (maxBlockSize < 0) return 0;
if (maxBlockSize > LZ4_MAX_INPUT_SIZE) return 0;
if (maxBlockSize < 16) maxBlockSize = 16;
return LZ4_DECODER_RING_BUFFER_SIZE(maxBlockSize);
} | /*! LZ4_decoderRingBufferSize() :
* when setting a ring buffer for streaming decompression (optional scenario),
* provides the minimum size of this ring buffer
* to be compatible with any source respecting maxBlockSize condition.
* Note : in a ring buffer scenario,
* blocks are presumed decompressed next to e... | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/Utils/LZ4/lz4.c#L2508-L2514 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | LZ4_decompress_safe_continue | LZ4_FORCE_O2
int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int compressedSize, int maxOutputSize)
{
LZ4_streamDecode_t_internal* lz4sd = &LZ4_streamDecode->internal_donotuse;
int result;
if (lz4sd->prefixSize == 0) {
/* The first call, no di... | /*
*_continue() :
These decoding functions allow decompression of multiple blocks in "streaming" mode.
Previously decoded blocks must still be available at the memory position where they were decoded.
If it's not possible, save the relevant part of decoded data into a safe buffer,
and indicate where it ... | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/Utils/LZ4/lz4.c#L2523-L2561 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | LZ4_decompress_safe_usingDict | int LZ4_decompress_safe_usingDict(const char* source, char* dest, int compressedSize, int maxOutputSize, const char* dictStart, int dictSize)
{
if (dictSize==0)
return LZ4_decompress_safe(source, dest, compressedSize, maxOutputSize);
if (dictStart+dictSize == dest) {
if (dictSize >= 64 KB - 1) {... | /*
Advanced decoding functions :
*_usingDict() :
These decoding functions work the same as "_continue" ones,
the dictionary must be explicitly provided within parameters
*/ | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/Utils/LZ4/lz4.c#L2612-L2625 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | LZ4_compress_limitedOutput | int LZ4_compress_limitedOutput(const char* source, char* dest, int inputSize, int maxOutputSize)
{
return LZ4_compress_default(source, dest, inputSize, maxOutputSize);
} | /*=*************************************************
* Obsolete Functions
***************************************************/
/* obsolete compression functions */ | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/Utils/LZ4/lz4.c#L2657-L2660 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | LZ4_uncompress | int LZ4_uncompress (const char* source, char* dest, int outputSize)
{
return LZ4_decompress_fast(source, dest, outputSize);
} | /*
These decompression functions are deprecated and should no longer be used.
They are only provided here for compatibility with older user programs.
- LZ4_uncompress is totally equivalent to LZ4_decompress_fast
- LZ4_uncompress_unknownOutputSize is totally equivalent to LZ4_decompress_safe
*/ | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/Utils/LZ4/lz4.c#L2688-L2691 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | LZ4_sizeofStreamState | int LZ4_sizeofStreamState(void) { return sizeof(LZ4_stream_t); } | /* Obsolete Streaming functions */ | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/Utils/LZ4/lz4.c#L2699-L2699 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | fp32_from_bits | static inline float fp32_from_bits(uint32_t w) {
union {
uint32_t as_bits;
float as_value;
} fp32;
fp32.as_bits = w;
return fp32.as_value;
} | // FP16 <-> FP32
// ref: https://github.com/Maratyszcza/FP16 | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L166-L173 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_vec_set_i8 | inline static void ggml_vec_set_i8(const int n, int8_t * x, const int8_t v) { for (int i = 0; i < n; ++i) x[i] = v; } | //
// fundamental operations
// | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L696-L696 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_vec_scale_f32 | inline static void ggml_vec_scale_f32(const int n, float * y, const float v) {
#if defined(GGML_SIMD)
const int np = (n & ~(GGML_F32_STEP - 1));
GGML_F32_VEC vx = GGML_F32_VEC_SET1(v);
GGML_F32_VEC ay[GGML_F32_ARR];
for (int i = 0; i < np; i += GGML_F32_STEP) {
for (int j = 0; j < GGML_F32_... | //inline static void ggml_vec_scale_f32(const int n, float * y, const float v) { for (int i = 0; i < n; ++i) y[i] *= v; } | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L962-L989 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_critical_section_start | inline static void ggml_critical_section_start() {
int processing = atomic_fetch_add(&g_state_barrier, 1);
while (processing > 0) {
// wait for other threads to finish
atomic_fetch_sub(&g_state_barrier, 1);
sched_yield(); // TODO: reconsider this
processing = atomic_fetch_add(&g... | // barrier via spin lock | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L1221-L1230 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_critical_section_end | inline static void ggml_critical_section_end() {
atomic_fetch_sub(&g_state_barrier, 1);
} | // TODO: make this somehow automatically executed
// some sort of "sentry" mechanism | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L1234-L1236 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_print_object | void ggml_print_object(const struct ggml_object * obj) {
GGML_PRINT(" - ggml_object: offset = %zu, size = %zu, next = %p\n",
obj->offset, obj->size, (const void *) obj->next);
} | //////////////////////////////////////////////////////////////////////////////// | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L1240-L1243 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_can_repeat | bool ggml_can_repeat(const struct ggml_tensor * t0, const struct ggml_tensor * t1) {
static_assert(GGML_MAX_DIMS == 4, "GGML_MAX_DIMS is not 4 - update this function");
return
(t1->ne[0]%t0->ne[0] == 0) &&
(t1->ne[1]%t0->ne[1] == 0) &&
(t1->ne[2]%t0->ne[2] == 0) &&
(t1->ne[3]%t0... | // check if t1 can be represented as a repeatition of t0 | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L1341-L1349 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_set_param | void ggml_set_param(
struct ggml_context * ctx,
struct ggml_tensor * tensor) {
tensor->is_param = true;
assert(tensor->grad == NULL);
tensor->grad = ggml_dup_tensor(ctx, tensor);
} | //////////////////////////////////////////////////////////////////////////////// | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L3046-L3053 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_dup_f16 | static void ggml_compute_forward_dup_f16(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0,
struct ggml_tensor * dst) {
assert(params->ith == 0);
assert(ggml_is_contiguous(dst));
assert(ggml_nelements(dst) == ggml_nelements(src0));
if (params->type == G... | // ggml_compute_forward_dup | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L3057-L3159 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_add_f32 | static void ggml_compute_forward_add_f32(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0,
const struct ggml_tensor * src1,
struct ggml_tensor * dst) {
GGML_ASSERT(ggml_are_same_shape(src0, src1) && ggml_are_same_shape(src0, dst));
if (params->type == ... | // ggml_compute_forward_add | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L3290-L3341 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_sub_f32 | static void ggml_compute_forward_sub_f32(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0,
const struct ggml_tensor * src1,
struct ggml_tensor * dst) {
assert(params->ith == 0);
assert(ggml_are_same_shape(src0, src1) && ggml_are_same_shape(src0, dst));
... | // ggml_compute_forward_sub | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L3366-L3391 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_mul_f32 | static void ggml_compute_forward_mul_f32(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0,
const struct ggml_tensor * src1,
struct ggml_tensor * dst) {
assert(params->ith == 0);
assert(ggml_are_same_shape(src0, src1) && ggml_are_same_shape(src0, dst));
... | // ggml_compute_forward_mul | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L3416-L3441 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_div_f32 | static void ggml_compute_forward_div_f32(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0,
const struct ggml_tensor * src1,
struct ggml_tensor * dst) {
assert(params->ith == 0);
assert(ggml_are_same_shape(src0, src1) && ggml_are_same_shape(src0, dst));
... | // ggml_compute_forward_div | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L3466-L3491 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_sqr_f32 | static void ggml_compute_forward_sqr_f32(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0,
struct ggml_tensor * dst) {
assert(params->ith == 0);
assert(ggml_are_same_shape(src0, dst));
if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALIZ... | // ggml_compute_forward_sqr | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L3516-L3538 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_sqrt_f32 | static void ggml_compute_forward_sqrt_f32(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0,
struct ggml_tensor * dst) {
assert(params->ith == 0);
assert(ggml_are_same_shape(src0, dst));
if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALI... | // ggml_compute_forward_sqrt | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L3562-L3584 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_sum_f32 | static void ggml_compute_forward_sum_f32(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0,
struct ggml_tensor * dst) {
assert(params->ith == 0);
assert(ggml_is_scalar(dst));
if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALIZE) {
... | // ggml_compute_forward_sum | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L3608-L3642 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_mean_f32 | static void ggml_compute_forward_mean_f32(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0,
struct ggml_tensor * dst) {
assert(params->ith == 0);
if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALIZE) {
return;
}
assert(src0... | // ggml_compute_forward_mean | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L3666-L3719 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_repeat_f32 | static void ggml_compute_forward_repeat_f32(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0,
struct ggml_tensor * dst) {
assert(params->ith == 0);
assert(ggml_can_repeat(src0, dst));
if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALIZE... | // ggml_compute_forward_repeat | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L3743-L3781 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_abs_f32 | static void ggml_compute_forward_abs_f32(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0,
struct ggml_tensor * dst) {
assert(params->ith == 0);
assert(ggml_are_same_shape(src0, dst));
if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALIZ... | // ggml_compute_forward_abs | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L3805-L3827 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_sgn_f32 | static void ggml_compute_forward_sgn_f32(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0,
struct ggml_tensor * dst) {
assert(params->ith == 0);
assert(ggml_are_same_shape(src0, dst));
if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALIZ... | // ggml_compute_forward_sgn | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L3851-L3873 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_neg_f32 | static void ggml_compute_forward_neg_f32(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0,
struct ggml_tensor * dst) {
assert(params->ith == 0);
assert(ggml_are_same_shape(src0, dst));
if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALIZ... | // ggml_compute_forward_neg | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L3897-L3919 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_step_f32 | static void ggml_compute_forward_step_f32(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0,
struct ggml_tensor * dst) {
assert(params->ith == 0);
assert(ggml_are_same_shape(src0, dst));
if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALI... | // ggml_compute_forward_step | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L3943-L3965 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_relu_f32 | static void ggml_compute_forward_relu_f32(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0,
struct ggml_tensor * dst) {
assert(params->ith == 0);
assert(ggml_are_same_shape(src0, dst));
if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALI... | // ggml_compute_forward_relu | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L3989-L4011 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_gelu_f32 | static void ggml_compute_forward_gelu_f32(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0,
struct ggml_tensor * dst) {
GGML_ASSERT(ggml_is_contiguous(src0));
GGML_ASSERT(ggml_is_contiguous(dst));
GGML_ASSERT(ggml_are_same_shape(src0, dst));
if (params... | // ggml_compute_forward_gelu | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L4035-L4074 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_norm_f32 | static void ggml_compute_forward_norm_f32(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0,
struct ggml_tensor * dst) {
GGML_ASSERT(ggml_are_same_shape(src0, dst));
if (params->type == GGML_TASK_INIT || params->type == GGML_TASK_FINALIZE) {
return;
... | // ggml_compute_forward_norm | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L4098-L4156 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_mul_mat_use_blas | static bool ggml_compute_forward_mul_mat_use_blas(
const struct ggml_tensor * src0,
const struct ggml_tensor * src1,
struct ggml_tensor * dst) {
UNUSED(src0);
const int ne10 = src1->ne[0];
const int ne0 = dst->ne[0];
const int ne1 = dst->ne[1];
// TODO: find the opti... | // helper function to determine if it is better to use BLAS or not
// for large matrices, BLAS is faster | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L4183-L4201 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_scale_f32 | static void ggml_compute_forward_scale_f32(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0,
const struct ggml_tensor * src1,
struct ggml_tensor * dst) {
GGML_ASSERT(ggml_is_contiguous(src0));
GGML_ASSERT(ggml_is_contiguous(dst));
GGML_ASSERT(ggml_a... | // ggml_compute_forward_scale | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L4777-L4810 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_cpy | static void ggml_compute_forward_cpy(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0,
struct ggml_tensor * dst) {
ggml_compute_forward_dup(params, src0, dst);
} | // ggml_compute_forward_cpy | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L4835-L4840 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_reshape | static void ggml_compute_forward_reshape(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0,
struct ggml_tensor * dst) {
// NOP
UNUSED(params);
UNUSED(src0);
UNUSED(dst);
} | // ggml_compute_forward_reshape | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L4844-L4852 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_view | static void ggml_compute_forward_view(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0) {
// NOP
UNUSED(params);
UNUSED(src0);
} | // ggml_compute_forward_view | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L4856-L4862 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_permute | static void ggml_compute_forward_permute(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0) {
// NOP
UNUSED(params);
UNUSED(src0);
} | // ggml_compute_forward_permute | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L4866-L4872 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_transpose | static void ggml_compute_forward_transpose(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0) {
// NOP
UNUSED(params);
UNUSED(src0);
} | // ggml_compute_forward_transpose | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L4876-L4882 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_get_rows_f16 | static void ggml_compute_forward_get_rows_f16(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0,
const struct ggml_tensor * src1,
struct ggml_tensor * dst) {
assert(params->ith == 0);
if (params->type == GGML_TASK_INIT || params->type == GGML_TASK... | // ggml_compute_forward_get_rows | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L4886-L4912 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_diag_mask_inf_f32 | static void ggml_compute_forward_diag_mask_inf_f32(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0,
const struct ggml_tensor * src1,
struct ggml_tensor * dst) {
assert(params->ith == 0);
assert(src1->type == GGML_TYPE_I32);
assert(ggml_nelements(sr... | // ggml_compute_forward_diag_mask_inf | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L4967-L5001 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_soft_max_f32 | static void ggml_compute_forward_soft_max_f32(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0,
struct ggml_tensor * dst) {
GGML_ASSERT(ggml_is_contiguous(src0));
GGML_ASSERT(ggml_is_contiguous(dst));
GGML_ASSERT(ggml_are_same_shape(src0, dst));
if (pa... | // ggml_compute_forward_soft_max | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L5026-L5095 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_rope_f32 | static void ggml_compute_forward_rope_f32(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0,
const struct ggml_tensor * src1,
struct ggml_tensor * dst) {
assert(params->ith == 0);
assert(src1->type == GGML_TYPE_I32);
assert(ggml_nelements(src1) == 3)... | // ggml_compute_forward_rope | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L5119-L5174 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_conv_1d_1s_f16_f32 | static void ggml_compute_forward_conv_1d_1s_f16_f32(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0,
const struct ggml_tensor * src1,
struct ggml_tensor * dst) {
GGML_ASSERT(src0->type == GGML_TYPE_F16);
GGML_ASSERT(src1->type == GGML_TYPE_F32);
... | // ggml_compute_forward_conv_1d_1s | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L5199-L5317 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_conv_1d_2s_f16_f32 | static void ggml_compute_forward_conv_1d_2s_f16_f32(
const struct ggml_compute_params * params,
const struct ggml_tensor * src0,
const struct ggml_tensor * src1,
struct ggml_tensor * dst) {
GGML_ASSERT(src0->type == GGML_TYPE_F16);
GGML_ASSERT(src1->type == GGML_TYPE_F32);
... | // ggml_compute_forward_conv_1d_2s | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L5465-L5583 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_flash_attn_f32 | static void ggml_compute_forward_flash_attn_f32(
const struct ggml_compute_params * params,
const struct ggml_tensor * q,
const struct ggml_tensor * k,
const struct ggml_tensor * v,
const bool masked,
struct ggml_tensor * dst) {
int64_t t0 = ggml_perf_time_us();
... | // ggml_compute_forward_flash_attn | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L5731-L5910 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward_flash_ff_f16 | static void ggml_compute_forward_flash_ff_f16(
const struct ggml_compute_params * params,
const struct ggml_tensor * a, // F16
const struct ggml_tensor * b0, // F16 fc_w
const struct ggml_tensor * b1, // F32 fc_b
const struct ggml_tensor * c0, // F16 proj_w
const struct ... | // ggml_compute_forward_flash_ff | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L6127-L6305 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Whisper | github_2023 | Const-me | c | ggml_compute_forward | static void ggml_compute_forward(struct ggml_compute_params * params, struct ggml_tensor * tensor) {
assert(params);
switch (tensor->op) {
case GGML_OP_DUP:
{
ggml_compute_forward_dup(params, tensor->src0, tensor);
} break;
case GGML_OP_ADD:
{... | ///////////////////////////////// | https://github.com/Const-me/Whisper/blob/306aadd1fce4b168cd38659236f4ba7c1603cebd/Whisper/source/ggml.c#L6336-L6480 | 306aadd1fce4b168cd38659236f4ba7c1603cebd |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.