summaryrefslogtreecommitdiffstats
path: root/libass
diff options
context:
space:
mode:
authorOneric <oneric@oneric.stub>2021-10-13 01:27:31 +0200
committerOneric <oneric@oneric.stub>2021-10-15 22:53:29 +0200
commit359a0673ad37fef2c8419dc6ab6c1f4f6c8a954b (patch)
treead4a8fe94433db8a844ea02161f60eed06818a84 /libass
parent2813f79b10fe144cbf6f8e7e9118702e72d66e5f (diff)
downloadlibass-359a0673ad37fef2c8419dc6ab6c1f4f6c8a954b.tar.bz2
libass-359a0673ad37fef2c8419dc6ab6c1f4f6c8a954b.tar.xz
Move the cache function to ass_cache.c
Diffstat (limited to 'libass')
-rw-r--r--libass/ass_cache.c22
-rw-r--r--libass/ass_utils.h22
2 files changed, 22 insertions, 22 deletions
diff --git a/libass/ass_cache.c b/libass/ass_cache.c
index 3ce4aff..6a699b5 100644
--- a/libass/ass_cache.c
+++ b/libass/ass_cache.c
@@ -30,6 +30,28 @@
#include "ass_outline.h"
#include "ass_cache.h"
+#define FNV1_32A_INIT 0x811c9dc5U
+#define FNV1_32A_PRIME 16777619U
+
+static inline uint32_t fnv_32a_buf(const void *buf, size_t len, uint32_t hval)
+{
+ if (!len)
+ return hval;
+
+ const uint8_t *bp = buf;
+ size_t n = (len + 3) / 4;
+
+ switch (len % 4) {
+ case 0: do { hval ^= *bp++; hval *= FNV1_32A_PRIME; //-fallthrough
+ case 3: hval ^= *bp++; hval *= FNV1_32A_PRIME; //-fallthrough
+ case 2: hval ^= *bp++; hval *= FNV1_32A_PRIME; //-fallthrough
+ case 1: hval ^= *bp++; hval *= FNV1_32A_PRIME;
+ } while (--n > 0);
+ }
+
+ return hval;
+}
+
// type-specific functions
// create hash/compare functions for bitmap, outline and composite cache
#define CREATE_HASH_FUNCTIONS
diff --git a/libass/ass_utils.h b/libass/ass_utils.h
index 4789179..5418ee6 100644
--- a/libass/ass_utils.h
+++ b/libass/ass_utils.h
@@ -182,28 +182,6 @@ static inline int double_to_d22(double x)
return lrint(x * 0x400000);
}
-#define FNV1_32A_INIT 0x811c9dc5U
-#define FNV1_32A_PRIME 16777619U
-
-static inline uint32_t fnv_32a_buf(const void *buf, size_t len, uint32_t hval)
-{
- if (!len)
- return hval;
-
- const uint8_t *bp = buf;
- size_t n = (len + 3) / 4;
-
- switch (len % 4) {
- case 0: do { hval ^= *bp++; hval *= FNV1_32A_PRIME; //-fallthrough
- case 3: hval ^= *bp++; hval *= FNV1_32A_PRIME; //-fallthrough
- case 2: hval ^= *bp++; hval *= FNV1_32A_PRIME; //-fallthrough
- case 1: hval ^= *bp++; hval *= FNV1_32A_PRIME;
- } while (--n > 0);
- }
-
- return hval;
-}
-
static inline int mystrtoi(char **p, int *res)
{
char *start = *p;