]>
git.ipfire.org Git - thirdparty/u-boot.git/blob - lib/zstd/error_private.h
1 /* SPDX-License-Identifier: (GPL-2.0 or BSD-3-Clause-Clear) */
3 * Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
7 /* Note : this module is expected to remain private, do not expose it */
10 #define ERROR_H_MODULE
12 /* ****************************************
14 ******************************************/
15 #include <linux/types.h> /* size_t */
16 #include <linux/zstd.h> /* enum list */
18 /* ****************************************
20 ******************************************/
21 #define ERR_STATIC static __attribute__((unused))
23 /*-****************************************
24 * Customization (error_public.h)
25 ******************************************/
26 typedef ZSTD_ErrorCode ERR_enum
;
27 #define PREFIX(name) ZSTD_error_##name
29 /*-****************************************
30 * Error codes handling
31 ******************************************/
32 #define ERROR(name) ((size_t)-PREFIX(name))
34 ERR_STATIC
unsigned ERR_isError(size_t code
) { return (code
> ERROR(maxCode
)); }
36 ERR_STATIC ERR_enum
ERR_getErrorCode(size_t code
)
38 if (!ERR_isError(code
))
40 return (ERR_enum
)(0 - code
);
43 #endif /* ERROR_H_MODULE */