summaryrefslogtreecommitdiff
path: root/include/kernel
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/kernel/kernel/sysclib.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/include/kernel/kernel/sysclib.h b/include/kernel/kernel/sysclib.h
new file mode 100644
index 0000000..c255e56
--- /dev/null
+++ b/include/kernel/kernel/sysclib.h
@@ -0,0 +1,41 @@
+#ifndef _DOLCESDK_PSP2KERN_KERNEL_SYSCLIB_H_
+#define _DOLCESDK_PSP2KERN_KERNEL_SYSCLIB_H_
+
+#include <psp2/types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Left shift with only register operations (no memory access).
+ */
+SceInt64 lshift(SceInt64 value, int shift);
+
+/**
+ * Arithmetic right shift with only register operations (no memory access).
+ */
+SceInt64 rshift(SceInt64 value, int shift);
+
+/**
+ * Arithmetic right shift with only register operations (no memory access).
+ * May be faster than rshift for shift less than 32.
+ */
+SceInt64 rshift_fast(SceInt64 value, int shift);
+
+/**
+ * Like memcmp but checks all n bytes of s1 and s2 without early return.
+ */
+int memcmp_consttime(const void *s1, const void *s2, size_t n);
+
+/**
+ * Like strncpy but puts 0 or 1 zero bytes after copying src to dest,
+ * rather than filling dest with zero bytes up to n.
+ */
+char *strncpy_fast(char *dest, const char *src, size_t n);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _DOLCESDK_PSP2KERN_KERNEL_SYSCLIB_H_ */