Files
ziran/bootstrap/compiler_backend_cache/compiler_backend_cache.h
T
waozi 436d73cf3a Regenerate the bootstrap without the TinyCC guard
The checked-arithmetic helpers every generated module carries no longer
test __TINYC__.
2026-11-15 21:56:20 -03:00

575 lines
23 KiB
C

/* Generated by zi2c from compiler_backend_cache.zi. */
#ifndef ZIRAN_COMPILER_BACKEND_CACHE_H
#define ZIRAN_COMPILER_BACKEND_CACHE_H
#include <stdbool.h>
#include "zir_string.h"
#include "zir_slice.h"
#include "file.h"
#include "vec.h"
#include "file_tree_linux.h"
#include "environment.h"
#include "text_tools.h"
#include "sort.h"
#include "process_run_linux.h"
#include "c_string.h"
#ifdef __cplusplus
extern "C" {
#endif
#define ItemMaximum 16384
#define ProbeMaximum 65536
#define PathMaximum 4096
#define CacheMagic "Ziran C cache 1\n"
#define IdentitySeed "Ziran native object cache 4"
typedef struct Digest Digest;
#ifndef ZIRAN_CONCRETE_FORWARD___type_c53c2d7c4913dc02
#define ZIRAN_CONCRETE_FORWARD___type_c53c2d7c4913dc02
typedef struct __type_c53c2d7c4913dc02 __type_c53c2d7c4913dc02;
#endif
typedef struct Fingerprint Fingerprint;
#ifndef ZIRAN_CONCRETE_FORWARD___type_d5737c4838766181
#define ZIRAN_CONCRETE_FORWARD___type_d5737c4838766181
typedef struct __type_d5737c4838766181 __type_d5737c4838766181;
#endif
typedef struct BuildCache BuildCache;
typedef struct ClockValue ClockValue;
typedef struct HashState HashState;
typedef struct ByteView ByteView;
typedef struct View View;
#ifndef ZIRAN_CONCRETE_FORWARD___type_838711075b90279a
#define ZIRAN_CONCRETE_FORWARD___type_838711075b90279a
typedef struct __type_838711075b90279a __type_838711075b90279a;
#endif
struct Digest {
uint8_t bytes[32];
};
#ifndef ZIRAN_CONCRETE___type_c53c2d7c4913dc02
#define ZIRAN_CONCRETE___type_c53c2d7c4913dc02
struct __type_c53c2d7c4913dc02 {
String* data;
int64_t count;
int64_t capacity;
};
#endif
struct Fingerprint {
String path;
String parent;
Digest digest;
PathInfo info;
bool unsafe;
__type_c53c2d7c4913dc02 probes;
bool directory;
bool recent;
};
#ifndef ZIRAN_CONCRETE___type_d5737c4838766181
#define ZIRAN_CONCRETE___type_d5737c4838766181
struct __type_d5737c4838766181 {
Fingerprint* data;
int64_t count;
int64_t capacity;
};
#endif
struct BuildCache {
Digest identity;
__type_c53c2d7c4913dc02 roots;
String output;
String executable;
int64_t started_seconds;
int64_t started_nanoseconds;
__type_d5737c4838766181 files;
__type_d5737c4838766181 candidates;
bool piped;
};
struct ClockValue {
ptrdiff_t seconds;
ptrdiff_t nanoseconds;
};
struct HashState {
uint8_t bytes[128];
};
struct ByteView {
uint8_t* data;
int64_t count;
};
struct View {
uint8_t* data;
size_t count;
};
#ifndef ZIRAN_CONCRETE___type_838711075b90279a
#define ZIRAN_CONCRETE___type_838711075b90279a
struct __type_838711075b90279a {
uint8_t* data;
int64_t count;
int64_t capacity;
};
#endif
extern __type_c53c2d7c4913dc02 ProfileNames;
#ifndef ZIR_FOREIGN_zir_f_36a3c20ab8e249b6_ClockRaw_b5740b84
#define ZIR_FOREIGN_zir_f_36a3c20ab8e249b6_ClockRaw_b5740b84
#ifdef __APPLE__
int32_t zir_foreign_zir_f_36a3c20ab8e249b6_ClockRaw(int32_t clock, ClockValue* value) __asm__("_clock_gettime");
#else
int32_t zir_foreign_zir_f_36a3c20ab8e249b6_ClockRaw(int32_t clock, ClockValue* value) __asm__("clock_gettime");
#endif
static int32_t
zir_f_36a3c20ab8e249b6_ClockRaw(int32_t clock, ClockValue* value)
{
return zir_foreign_zir_f_36a3c20ab8e249b6_ClockRaw(clock, value);
}
#endif
#ifndef ZIR_FOREIGN_zir_f_36a3c20ab8e249b6_ShaBegin_6c69662e
#define ZIR_FOREIGN_zir_f_36a3c20ab8e249b6_ShaBegin_6c69662e
#ifdef __APPLE__
void zir_foreign_zir_f_36a3c20ab8e249b6_ShaBegin(void* hash) __asm__("_Sha256Begin");
#else
void zir_foreign_zir_f_36a3c20ab8e249b6_ShaBegin(void* hash) __asm__("Sha256Begin");
#endif
static void
zir_f_36a3c20ab8e249b6_ShaBegin(void* hash)
{
zir_foreign_zir_f_36a3c20ab8e249b6_ShaBegin(hash);
}
#endif
#ifndef ZIR_FOREIGN_zir_f_36a3c20ab8e249b6_ShaAdd_a910f077
#define ZIR_FOREIGN_zir_f_36a3c20ab8e249b6_ShaAdd_a910f077
#ifdef __APPLE__
void zir_foreign_zir_f_36a3c20ab8e249b6_ShaAdd(void* hash, uint8_t* bytes, size_t count) __asm__("_Sha256Add");
#else
void zir_foreign_zir_f_36a3c20ab8e249b6_ShaAdd(void* hash, uint8_t* bytes, size_t count) __asm__("Sha256Add");
#endif
static void
zir_f_36a3c20ab8e249b6_ShaAdd(void* hash, uint8_t* bytes, size_t count)
{
zir_foreign_zir_f_36a3c20ab8e249b6_ShaAdd(hash, bytes, count);
}
#endif
#ifndef ZIR_FOREIGN_zir_f_36a3c20ab8e249b6_ShaEnd_1d78bba0
#define ZIR_FOREIGN_zir_f_36a3c20ab8e249b6_ShaEnd_1d78bba0
#ifdef __APPLE__
void zir_foreign_zir_f_36a3c20ab8e249b6_ShaEnd(void* hash, uint8_t* output) __asm__("_Sha256End");
#else
void zir_foreign_zir_f_36a3c20ab8e249b6_ShaEnd(void* hash, uint8_t* output) __asm__("Sha256End");
#endif
static void
zir_f_36a3c20ab8e249b6_ShaEnd(void* hash, uint8_t* output)
{
zir_foreign_zir_f_36a3c20ab8e249b6_ShaEnd(hash, output);
}
#endif
#ifndef ZIR_FOREIGN_zir_f_36a3c20ab8e249b6_AllocateRaw_0c09ffff
#define ZIR_FOREIGN_zir_f_36a3c20ab8e249b6_AllocateRaw_0c09ffff
#ifdef __APPLE__
void* zir_foreign_zir_f_36a3c20ab8e249b6_AllocateRaw(size_t count, size_t size) __asm__("_calloc");
#else
void* zir_foreign_zir_f_36a3c20ab8e249b6_AllocateRaw(size_t count, size_t size) __asm__("calloc");
#endif
static void*
zir_f_36a3c20ab8e249b6_AllocateRaw(size_t count, size_t size)
{
return zir_foreign_zir_f_36a3c20ab8e249b6_AllocateRaw(count, size);
}
#endif
#ifndef ZIR_FOREIGN_zir_f_36a3c20ab8e249b6_FreeOwned_c75930da
#define ZIR_FOREIGN_zir_f_36a3c20ab8e249b6_FreeOwned_c75930da
#ifdef __APPLE__
void zir_foreign_zir_f_36a3c20ab8e249b6_FreeOwned(void* memory) __asm__("_free");
#else
void zir_foreign_zir_f_36a3c20ab8e249b6_FreeOwned(void* memory) __asm__("free");
#endif
static void
zir_f_36a3c20ab8e249b6_FreeOwned(void* memory)
{
zir_foreign_zir_f_36a3c20ab8e249b6_FreeOwned(memory);
}
#endif
#ifndef ZIR_FOREIGN_zir_f_36a3c20ab8e249b6_ProfileCountForeign_c5a6224b
#define ZIR_FOREIGN_zir_f_36a3c20ab8e249b6_ProfileCountForeign_c5a6224b
#ifdef __APPLE__
void zir_foreign_zir_f_36a3c20ab8e249b6_ProfileCountForeign(uint8_t* name) __asm__("_ProfileCount");
#else
void zir_foreign_zir_f_36a3c20ab8e249b6_ProfileCountForeign(uint8_t* name) __asm__("ProfileCount");
#endif
static void
zir_f_36a3c20ab8e249b6_ProfileCountForeign(uint8_t* name)
{
zir_foreign_zir_f_36a3c20ab8e249b6_ProfileCountForeign(name);
}
#endif
#ifndef ZIR_FOREIGN_zir_f_36a3c20ab8e249b6_OwnProcessId_bd88b581
#define ZIR_FOREIGN_zir_f_36a3c20ab8e249b6_OwnProcessId_bd88b581
#ifdef __APPLE__
int32_t zir_foreign_zir_f_36a3c20ab8e249b6_OwnProcessId(void) __asm__("_getpid");
#else
int32_t zir_foreign_zir_f_36a3c20ab8e249b6_OwnProcessId(void) __asm__("getpid");
#endif
static int32_t
zir_f_36a3c20ab8e249b6_OwnProcessId(void)
{
return zir_foreign_zir_f_36a3c20ab8e249b6_OwnProcessId();
}
#endif
#ifndef ZIR_FOREIGN_zir_f_36a3c20ab8e249b6_CurrentDirectory_a9b77685
#define ZIR_FOREIGN_zir_f_36a3c20ab8e249b6_CurrentDirectory_a9b77685
#ifdef __APPLE__
uint8_t* zir_foreign_zir_f_36a3c20ab8e249b6_CurrentDirectory(uint8_t* output, size_t size) __asm__("_getcwd");
#else
uint8_t* zir_foreign_zir_f_36a3c20ab8e249b6_CurrentDirectory(uint8_t* output, size_t size) __asm__("getcwd");
#endif
static uint8_t*
zir_f_36a3c20ab8e249b6_CurrentDirectory(uint8_t* output, size_t size)
{
return zir_foreign_zir_f_36a3c20ab8e249b6_CurrentDirectory(output, size);
}
#endif
HashState compiler_backend_cache_HashNew(void);
void compiler_backend_cache_HashByte(HashState* hash, uint8_t value);
void compiler_backend_cache_HashBytes(HashState* hash, String value);
void compiler_backend_cache_HashInteger(HashState* hash, uint64_t value);
void compiler_backend_cache_HashText(HashState* hash, String value);
void compiler_backend_cache_HashFinish(HashState* hash, Digest* output);
void compiler_backend_cache_ProfileCount(String name);
uint8_t* compiler_backend_cache_ProfileName(String name);
Slice compiler_backend_cache_BytesFromPointer(uint8_t* data, uint64_t count);
String compiler_backend_cache_Owned(String value);
void compiler_backend_cache_Release(String value);
bool compiler_backend_cache_SameText(String left, String right);
bool compiler_backend_cache_HasPrefix(String value, String prefix);
bool compiler_backend_cache_HasSuffix(String value, String suffix);
bool compiler_backend_cache_Contains(String value, String piece);
String compiler_backend_cache_TextName(String value);
String compiler_backend_cache_JoinTemporary(String left, String right);
String compiler_backend_cache_JoinPath(String left, String right);
bool compiler_backend_cache_AppendOwned(__type_c53c2d7c4913dc02* values, String value);
void compiler_backend_cache_ClearNames(__type_c53c2d7c4913dc02* values);
String compiler_backend_cache_Executable(String command);
bool compiler_backend_cache_Runnable(String path);
String compiler_backend_cache_Resolved(String path);
bool compiler_backend_cache_NativeImage(String path);
bool compiler_backend_cache_PairedArgument(String value);
bool compiler_backend_cache_RequestedPipe(Slice arguments);
bool compiler_backend_cache_UnsupportedEffects(void);
bool compiler_backend_cache_SupportedArguments(Slice arguments);
bool compiler_backend_cache_SupportedOption(String value);
int64_t compiler_backend_cache_FileFind(BuildCache* cache, String path, bool directory);
int64_t compiler_backend_cache_FileAdd(BuildCache* cache, String path, bool directory);
int64_t compiler_backend_cache_ProbeLiteral(String text, int64_t start, String* name);
int64_t compiler_backend_cache_Minimum(int64_t left, int64_t right);
bool compiler_backend_cache_UnsafeText(String text);
bool compiler_backend_cache_ProbeNames(String text, __type_c53c2d7c4913dc02* names);
int64_t compiler_backend_cache_FileDigest(BuildCache* cache, String path);
bool compiler_backend_cache_OlderThanBuild(BuildCache* cache, PathInfo info, bool changed);
int64_t compiler_backend_cache_SpellingDigest(BuildCache* cache, String spelling, String root);
bool compiler_backend_cache_EnvironmentEntries(Slice bytes, __type_c53c2d7c4913dc02* entries);
bool compiler_backend_cache_CompilerEnvironment(String entry);
bool compiler_backend_cache_HashEnvironment(HashState* hash);
__type_838711075b90279a compiler_backend_cache_Probe(Slice arguments, bool piped);
bool compiler_backend_cache_HashProbeOutput(HashState* hash, String text);
bool compiler_backend_cache_JoinProbeVersions(__type_c53c2d7c4913dc02* lines);
BuildCache* compiler_backend_cache_Open(Slice arguments, String output, String executable);
void compiler_backend_cache_HashSnapshot(HashState* hash, PathInfo info);
String compiler_backend_cache_ToolFromLine(String line);
bool compiler_backend_cache_ParseProbe(BuildCache* cache, HashState* hash, String text, bool piped);
bool compiler_backend_cache_SpellingKey(BuildCache* cache, HashState* hash, String spelling, __type_c53c2d7c4913dc02* parents, bool* recordable);
bool compiler_backend_cache_LookupDigest(BuildCache* cache, __type_c53c2d7c4913dc02* dependencies, Digest* output, bool recording);
bool compiler_backend_cache_ReadDependencies(String object, __type_c53c2d7c4913dc02* dependencies);
bool compiler_backend_cache_ReadInteger(Slice bytes, int64_t* offset, uint32_t* output);
bool compiler_backend_cache_ReadDigest(Slice bytes, int64_t* offset, Digest* output);
bool compiler_backend_cache_SameDigest(Digest left, Digest right);
bool compiler_backend_cache_Piped(BuildCache* cache);
bool compiler_backend_cache_Hit(BuildCache* cache, String object);
bool compiler_backend_cache_AppendBytes(__type_838711075b90279a* output, Slice bytes);
bool compiler_backend_cache_AppendText(__type_838711075b90279a* output, String value);
bool compiler_backend_cache_AppendDigest(__type_838711075b90279a* output, Digest value);
bool compiler_backend_cache_AppendCount(__type_838711075b90279a* output, uint32_t value);
bool compiler_backend_cache_AppendNumber(__type_838711075b90279a* output, int64_t value);
String compiler_backend_cache_TemporaryInputPath(String object, int64_t attempt);
void compiler_backend_cache_Record(BuildCache* cache, String object, String source);
void compiler_backend_cache_ReleaseFingerprints(__type_d5737c4838766181* values);
void compiler_backend_cache_Close(BuildCache* cache);
/* Small procedures other modules inline; compiler_backend_cache.c defines them. */
#if !defined(__cplusplus) && !defined(ZIRAN_COMPILER_BACKEND_CACHE_H_SOURCE) && !defined(ZIRAN_NO_HEADER_INLINE)
#include "zir_vec.h"
#include <stdbool.h>
#include "zir_string.h"
#ifndef ZIRAN_HELPER_ZiShl32
#define ZIRAN_HELPER_ZiShl32
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__OPTIMIZE__)
#define ZiShl32(a, s, w) __extension__ ({ uint32_t __zi_a = (a); uint64_t __zi_s = (s); if(__zi_s >= (uint64_t)(w)) abort(); (uint32_t)(__zi_a << __zi_s); })
#else
static inline uint32_t ZiShl32(uint32_t a, uint64_t s, int w) {
if(s >= (uint64_t)w) abort();
return (uint32_t)(a << s);
}
#endif
#endif
static inline void compiler_backend_cache_HashBytes_ziran_inline(HashState* hash, String value);
#define compiler_backend_cache_HashBytes(...) compiler_backend_cache_HashBytes_ziran_inline(__VA_ARGS__)
static inline void compiler_backend_cache_HashText_ziran_inline(HashState* hash, String value);
#define compiler_backend_cache_HashText(...) compiler_backend_cache_HashText_ziran_inline(__VA_ARGS__)
static inline Slice compiler_backend_cache_BytesFromPointer_ziran_inline(uint8_t* data, uint64_t count);
#define compiler_backend_cache_BytesFromPointer(...) compiler_backend_cache_BytesFromPointer_ziran_inline(__VA_ARGS__)
static inline String compiler_backend_cache_Owned_ziran_inline(String value);
#define compiler_backend_cache_Owned(...) compiler_backend_cache_Owned_ziran_inline(__VA_ARGS__)
static inline bool compiler_backend_cache_SameText_ziran_inline(String left, String right);
#define compiler_backend_cache_SameText(...) compiler_backend_cache_SameText_ziran_inline(__VA_ARGS__)
static inline bool compiler_backend_cache_HasPrefix_ziran_inline(String value, String prefix);
#define compiler_backend_cache_HasPrefix(...) compiler_backend_cache_HasPrefix_ziran_inline(__VA_ARGS__)
static inline bool compiler_backend_cache_HasSuffix_ziran_inline(String value, String suffix);
#define compiler_backend_cache_HasSuffix(...) compiler_backend_cache_HasSuffix_ziran_inline(__VA_ARGS__)
static inline bool compiler_backend_cache_Contains_ziran_inline(String value, String piece);
#define compiler_backend_cache_Contains(...) compiler_backend_cache_Contains_ziran_inline(__VA_ARGS__)
static inline bool compiler_backend_cache_Runnable_ziran_inline(String path);
#define compiler_backend_cache_Runnable(...) compiler_backend_cache_Runnable_ziran_inline(__VA_ARGS__)
static inline int64_t compiler_backend_cache_FileFind_ziran_inline(BuildCache* cache, String path, bool directory);
#define compiler_backend_cache_FileFind(...) compiler_backend_cache_FileFind_ziran_inline(__VA_ARGS__)
static inline int64_t compiler_backend_cache_Minimum_ziran_inline(int64_t left, int64_t right);
#define compiler_backend_cache_Minimum(...) compiler_backend_cache_Minimum_ziran_inline(__VA_ARGS__)
static inline bool compiler_backend_cache_OlderThanBuild_ziran_inline(BuildCache* cache, PathInfo info, bool changed);
#define compiler_backend_cache_OlderThanBuild(...) compiler_backend_cache_OlderThanBuild_ziran_inline(__VA_ARGS__)
static inline void compiler_backend_cache_HashSnapshot_ziran_inline(HashState* hash, PathInfo info);
#define compiler_backend_cache_HashSnapshot(...) compiler_backend_cache_HashSnapshot_ziran_inline(__VA_ARGS__)
static inline bool compiler_backend_cache_ReadInteger_ziran_inline(Slice bytes, int64_t* offset, uint32_t* output);
#define compiler_backend_cache_ReadInteger(...) compiler_backend_cache_ReadInteger_ziran_inline(__VA_ARGS__)
static inline bool compiler_backend_cache_ReadDigest_ziran_inline(Slice bytes, int64_t* offset, Digest* output);
#define compiler_backend_cache_ReadDigest(...) compiler_backend_cache_ReadDigest_ziran_inline(__VA_ARGS__)
static inline bool compiler_backend_cache_SameDigest_ziran_inline(Digest left, Digest right);
#define compiler_backend_cache_SameDigest(...) compiler_backend_cache_SameDigest_ziran_inline(__VA_ARGS__)
static inline bool compiler_backend_cache_Piped_ziran_inline(BuildCache* cache);
#define compiler_backend_cache_Piped(...) compiler_backend_cache_Piped_ziran_inline(__VA_ARGS__)
static inline void
compiler_backend_cache_HashBytes_ziran_inline(HashState* hash, String value)
{
for (int64_t it_index = 0LL; it_index < (int64_t)(value).length; it_index++) {
uint8_t byte = (uint8_t)value.data[it_index];
compiler_backend_cache_HashByte(hash, byte);
}
}
static inline void
compiler_backend_cache_HashText_ziran_inline(HashState* hash, String value)
{
compiler_backend_cache_HashInteger(hash, (uint64_t)((int64_t)(value).length));
for (int64_t it_index = 0LL; it_index < (int64_t)(value).length; it_index++) {
uint8_t byte = (uint8_t)value.data[it_index];
compiler_backend_cache_HashByte(hash, byte);
}
}
static inline Slice
compiler_backend_cache_BytesFromPointer_ziran_inline(uint8_t* data, uint64_t count)
{
Slice result = {0};
if (data == ((void *)0)) {
return result;
}
ByteView* descriptor = (ByteView*)(&(result));
uint8_t** value_0 = &(descriptor->data);
(*value_0) = data;
int64_t* value_1 = &(descriptor->count);
(*value_1) = (int64_t)(count);
return result;
}
static inline String
compiler_backend_cache_Owned_ziran_inline(String value)
{
return vec_TextDetach(vec_TextCopy(value));
}
static inline bool
compiler_backend_cache_SameText_ziran_inline(String left, String right)
{
return StringEqual(left, right);
}
static inline bool
compiler_backend_cache_HasPrefix_ziran_inline(String value, String prefix)
{
return text_tools_TextHasPrefix(value, prefix);
}
static inline bool
compiler_backend_cache_HasSuffix_ziran_inline(String value, String suffix)
{
return text_tools_TextHasSuffix(value, suffix);
}
static inline bool
compiler_backend_cache_Contains_ziran_inline(String value, String piece)
{
return text_tools_TextContains(value, piece);
}
static inline bool
compiler_backend_cache_Runnable_ziran_inline(String path)
{
PathInfo info = file_tree_linux_PathStatus(path, true);
return ((PathKind)(info.kind)) == ((PathKind)(1)) && ((int32_t)((uint32_t)(info.mode) & 73u)) != 0;
}
static inline int64_t
compiler_backend_cache_FileFind_ziran_inline(BuildCache* cache, String path, bool directory)
{
if (directory) {
{
int64_t range_first_1 = 0LL;
int64_t range_last_1 = (int64_t)((uint64_t)(cache->candidates.count) - UINT64_C(1));
int64_t index = range_first_1;
if (index <= range_last_1) for (;;) {
if (StringEqual((ZIRAN_VEC_INDEX((cache->candidates).data, (cache->candidates).count, index)).path, path)) {
return index;
}
if (index == range_last_1) {
break;
}
index = (int64_t)((uint64_t)index + UINT64_C(1));
}
}
} else {
{
int64_t range_first_8 = 0LL;
int64_t range_last_8 = (int64_t)((uint64_t)(cache->files.count) - UINT64_C(1));
int64_t index = range_first_8;
if (index <= range_last_8) for (;;) {
if (StringEqual((ZIRAN_VEC_INDEX((cache->files).data, (cache->files).count, index)).path, path)) {
return index;
}
if (index == range_last_8) {
break;
}
index = (int64_t)((uint64_t)index + UINT64_C(1));
}
}
}
return -1LL;
}
static inline int64_t
compiler_backend_cache_Minimum_ziran_inline(int64_t left, int64_t right)
{
int64_t value_0 = 0;
if (left < right) {
value_0 = left;
} else {
value_0 = right;
}
return value_0;
}
static inline bool
compiler_backend_cache_OlderThanBuild_ziran_inline(BuildCache* cache, PathInfo info, bool changed)
{
int64_t value_0 = 0;
if (changed) {
value_0 = info.changed;
} else {
value_0 = info.modified;
}
int64_t seconds = value_0;
uint32_t value_1 = 0;
if (changed) {
value_1 = info.changed_nanoseconds;
} else {
value_1 = info.modified_nanoseconds;
}
uint32_t nanoseconds = value_1;
int64_t value_2 = cache->started_seconds;
if (seconds != value_2) {
int64_t value_3 = cache->started_seconds;
return seconds < value_3;
}
int64_t value_4 = (int64_t)(nanoseconds);
int64_t value_5 = cache->started_nanoseconds;
return value_4 < value_5;
}
static inline void
compiler_backend_cache_HashSnapshot_ziran_inline(HashState* hash, PathInfo info)
{
compiler_backend_cache_HashInteger(hash, (uint64_t)(info.device_major));
compiler_backend_cache_HashInteger(hash, (uint64_t)(info.device_minor));
compiler_backend_cache_HashInteger(hash, info.inode);
compiler_backend_cache_HashInteger(hash, (uint64_t)(info.mode));
compiler_backend_cache_HashInteger(hash, (uint64_t)(info.size));
compiler_backend_cache_HashInteger(hash, (uint64_t)(info.modified));
compiler_backend_cache_HashInteger(hash, (uint64_t)(info.modified_nanoseconds));
compiler_backend_cache_HashInteger(hash, (uint64_t)(info.changed));
compiler_backend_cache_HashInteger(hash, (uint64_t)(info.changed_nanoseconds));
}
static inline bool
compiler_backend_cache_ReadInteger_ziran_inline(Slice bytes, int64_t* offset, uint32_t* output)
{
int64_t value_0 = (int64_t)((uint64_t)(*(offset)) + UINT64_C(4));
int64_t value_1 = (int64_t)(bytes).length;
if (value_0 > value_1) {
return false;
}
uint32_t value = 0;
for (int64_t index = 0LL; index <= 3LL; index++) {
uint8_t value_2 = ((uint8_t *)bytes.data)[SliceIndex(bytes, (int64_t)((int64_t)((uint64_t)(*(offset)) + (uint64_t)index)))];
uint32_t value_3 = ZiShl32((uint32_t)(value_2), (uint64_t)((uint32_t)(((int64_t)(UINT64_C(8) * (uint64_t)index)))), 32);
value = (uint32_t)((uint32_t)value | (uint32_t)value_3);
}
int64_t* value_4 = &((*(offset)));
(*value_4) = (int64_t)((uint64_t)((*value_4)) + UINT64_C(4));
uint32_t* value_5 = &((*(output)));
(*value_5) = value;
return true;
}
static inline bool
compiler_backend_cache_ReadDigest_ziran_inline(Slice bytes, int64_t* offset, Digest* output)
{
int64_t value_0 = (int64_t)((uint64_t)(*(offset)) + UINT64_C(32));
int64_t value_1 = (int64_t)(bytes).length;
if (value_0 > value_1) {
return false;
}
for (int64_t index = 0LL; index <= 31LL; index++) {
uint8_t* value_2 = &(output->bytes[index]);
uint8_t value_3 = ((uint8_t *)bytes.data)[SliceIndex(bytes, (int64_t)((int64_t)((uint64_t)(*(offset)) + (uint64_t)index)))];
(*value_2) = value_3;
}
int64_t* value_4 = &((*(offset)));
(*value_4) = (int64_t)((uint64_t)((*value_4)) + UINT64_C(32));
return true;
}
static inline bool
compiler_backend_cache_SameDigest_ziran_inline(Digest left, Digest right)
{
for (int64_t index = 0LL; index <= 31LL; index++) {
if ((left.bytes)[index] != (right.bytes)[index]) {
return false;
}
}
return true;
}
static inline bool
compiler_backend_cache_Piped_ziran_inline(BuildCache* cache)
{
return cache != ((void *)0) && cache->piped;
}
#endif
#ifdef __cplusplus
}
#endif
#endif /* ZIRAN_COMPILER_BACKEND_CACHE_H */