mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-27 18:51:41 +02:00
Ensure parser buffer is aligned to 64 bytes
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
#include "state.h"
|
#include "state.h"
|
||||||
#include "modes.h"
|
#include "modes.h"
|
||||||
#include "simd-string.h"
|
#include "simd-string.h"
|
||||||
|
#include <stdalign.h>
|
||||||
|
|
||||||
#define BUF_SZ (1024u*1024u)
|
#define BUF_SZ (1024u*1024u)
|
||||||
// The extra bytes are so loads of large integers such as for AVX 512 dont read past the end of the buffer
|
// The extra bytes are so loads of large integers such as for AVX 512 dont read past the end of the buffer
|
||||||
@@ -207,7 +208,7 @@ typedef struct PS {
|
|||||||
// The buffer
|
// The buffer
|
||||||
struct { size_t consumed, pos, sz; } read;
|
struct { size_t consumed, pos, sz; } read;
|
||||||
struct { size_t offset, sz, pending; } write;
|
struct { size_t offset, sz, pending; } write;
|
||||||
uint8_t buf[BUF_SZ + BUF_EXTRA];
|
alignas(BUF_EXTRA) uint8_t buf[BUF_SZ + BUF_EXTRA];
|
||||||
} PS;
|
} PS;
|
||||||
static_assert(offsetof(PS, buf) > sizeof(BYTE_LOADER_T), "There must be enough space before the buf[] array for aligned loads");
|
static_assert(offsetof(PS, buf) > sizeof(BYTE_LOADER_T), "There must be enough space before the buf[] array for aligned loads");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user