util: Delete Offset() macro from u_memory.h

Reviewed-by: Giancarlo Devich <gdevich@microsoft.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22494>
This commit is contained in:
Jesse Natalie 2023-04-13 14:02:58 -07:00 committed by Marge Bot
parent 7706d1cc33
commit 2fbedd442a
3 changed files with 2 additions and 8 deletions

View file

@ -773,7 +773,7 @@ lp_make_setup_variant_key(const struct llvmpipe_context *lp,
key->pixel_center_half = lp->rasterizer->half_pixel_center;
key->multisample = lp->rasterizer->multisample;
key->twoside = lp->rasterizer->light_twoside;
key->size = Offset(struct lp_setup_variant_key, inputs[key->num_inputs]);
key->size = offsetof(struct lp_setup_variant_key, inputs[key->num_inputs]);
key->color_slot = lp->color_slot[0];
key->bcolor_slot = lp->bcolor_slot[0];

View file

@ -61,7 +61,7 @@ struct geometry_constant {
#define set_uniform_location(var, field, packed) \
do { \
unsigned offset = Offset(struct geometry_constant, field); \
unsigned offset = offsetof(struct geometry_constant, field); \
var->data.driver_location = offset >> (packed ? 2 : 4); \
var->data.location_frac = (offset >> 2) & 0x3; \
} while (0)

View file

@ -83,12 +83,6 @@ mem_dup(const void *src, size_t size)
return dup;
}
/**
* Offset of a field in a struct, in bytes.
*/
#define Offset(TYPE, MEMBER) ((uintptr_t)&(((TYPE *)NULL)->MEMBER))
/* TODO: this could be different on non-x86 architectures. */
#define CACHE_LINE_SIZE 64