util/sparse_array: don't stomp head's counter on pop operations

By temporarily storing the new_head by a uint32_t, we wipe out the
counter section of the head pointer.

Fixes: e4f01eca ("util: Add a free list structure for use with util_sparse_array")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4612>
(cherry picked from commit dc3a17997b479f91f36b2421e9c41c11a025de47)

Cherry-pick'd from 5ef9dccff3fda298af89218009e5a3553c296200

Change-Id: Ic2a94160b426dcc60ca8f4bb56f4b7ff9501f532
Reviewed-on: https://fuchsia-review.googlesource.com/c/third_party/mesa/+/399926
Reviewed-by: Craig Stout <cstout@google.com>
1 file changed