#include <string.h>
-#include "main/macros.h"
#include "blob.h"
+#include "u_math.h"
#ifdef HAVE_VALGRIND
#include <valgrind.h>
static bool
align_blob(struct blob *blob, size_t alignment)
{
- const size_t new_size = ALIGN(blob->size, alignment);
+ const size_t new_size = align64(blob->size, alignment);
if (blob->size < new_size) {
if (!grow_to_fit(blob, new_size - blob->size))
static void
align_blob_reader(struct blob_reader *blob, size_t alignment)
{
- blob->current = blob->data + ALIGN(blob->current - blob->data, alignment);
+ blob->current = blob->data + align64(blob->current - blob->data, alignment);
}
void
BLOB_WRITE_TYPE(blob_write_intptr, intptr_t)
#define ASSERT_ALIGNED(_offset, _align) \
- assert(ALIGN((_offset), (_align)) == (_offset))
+ assert(align64((_offset), (_align)) == (_offset))
bool
blob_overwrite_uint8 (struct blob *blob,
#include <errno.h>
#include <string.h>
-#include "main/macros.h"
#include "debug.h"
#include "u_string.h"
#include "util/mesa-sha1.h"
#include "util/ralloc.h"
#include "util/compiler.h"
-#include "main/errors.h"
#include "disk_cache.h"
#include "hash_table.h"
#include "ralloc.h"
#include "macros.h"
-#include "main/hash.h"
+#include "u_memory.h"
#include "fast_urem_by_const.h"
#define XXH_INLINE_ALL
#include "xxhash.h"
+/**
+ * Magic number that gets stored outside of the struct hash_table.
+ *
+ * The hash table needs a particular pointer to be the marker for a key that
+ * was deleted from the table, along with NULL for the "never allocated in the
+ * table" marker. Legacy GL allows any GLuint to be used as a GL object name,
+ * and we use a 1:1 mapping from GLuints to key pointers, so we need to be
+ * able to track a GLuint that happens to match the deleted key outside of
+ * struct hash_table. We tell the hash table to use "1" as the deleted key
+ * value, so that we test the deleted-key-in-the-table path as best we can.
+ */
+#define DELETED_KEY_VALUE 1
+
+static inline void *
+uint_key(unsigned id)
+{
+ return (void *)(uintptr_t) id;
+}
+
static const uint32_t deleted_key_value;
/**
*/
#include <stdbool.h>
+#include <limits.h>
#include "ralloc.h"
#include "util/imports.h"
-#include "main/macros.h"
#include "util/bitset.h"
+#include "u_math.h"
#include "register_allocate.h"
struct ra_reg {
* easier to memset the top of the growing bitsets.
*/
assert(g->alloc % BITSET_WORDBITS == 0);
- alloc = ALIGN(alloc, BITSET_WORDBITS);
+ alloc = align64(alloc, BITSET_WORDBITS);
g->nodes = reralloc(g, g->nodes, struct ra_node, alloc);