mesa/src/intel/tools/error_decode_lib.c
José Roberto de Souza 9b58301766 intel/tools: Move ascii85_decode_char() to error_decode_lib
This was re-implemented in several places, so lets share it.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28720>
2024-04-18 19:12:41 +00:00

25 lines
425 B
C

/*
* Copyright 2024 Intel Corporation
* SPDX-License-Identifier: MIT
*/
#include "error_decode_lib.h"
const char *
ascii85_decode_char(const char *in, uint32_t *v)
{
*v = 0;
if (*in == 'z') {
in++;
} else {
*v += in[0] - 33; *v *= 85;
*v += in[1] - 33; *v *= 85;
*v += in[2] - 33; *v *= 85;
*v += in[3] - 33; *v *= 85;
*v += in[4] - 33;
in += 5;
}
return in;
}