diff options
author | wm4 <wm4@nowhere> | 2014-01-29 18:11:13 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-02-02 20:02:40 +0100 |
commit | da4af2b6d86491536b0999f5b731c30b13ff0ac9 (patch) | |
tree | 9b941ab8dba74b2804993fe1bd7aa2fe9063926d /libass/ass_utils.h | |
parent | 7514642f2575fd58c4f4809d74a0099f22d256f0 (diff) | |
download | libass-da4af2b6d86491536b0999f5b731c30b13ff0ac9.tar.bz2 libass-da4af2b6d86491536b0999f5b731c30b13ff0ac9.tar.xz |
Use a function for aligned memory allocations
...instead of doing this manually.
Diffstat (limited to 'libass/ass_utils.h')
-rw-r--r-- | libass/ass_utils.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libass/ass_utils.h b/libass/ass_utils.h index 4e2ba6c..7228b36 100644 --- a/libass/ass_utils.h +++ b/libass/ass_utils.h @@ -49,6 +49,9 @@ int has_avx(void); int has_avx2(void); #endif +void *ass_aligned_alloc(size_t alignment, size_t size); +void ass_aligned_free(void *ptr); + int mystrtoi(char **p, int *res); int mystrtoll(char **p, long long *res); int mystrtou32(char **p, int base, uint32_t *res); @@ -70,6 +73,11 @@ void *ass_guess_buffer_cp(ASS_Library *library, unsigned char *buffer, /* defined in ass_strtod.c */ double ass_strtod(const char *string, char **endPtr); +static inline size_t ass_align(size_t alignment, size_t s) +{ + return (s + (alignment - 1)) & ~(alignment - 1); +} + static inline int d6_to_int(int x) { return (x + 32) >> 6; |