bpf: Undo incorrect __reg_bound_offset32 handling
[linux/fpc-iii.git] / lib / zstd / error_private.h
blob1a60b31f706cb69f8df04608b701d4dfb3f2a085
1 /**
2 * Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
3 * All rights reserved.
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the root directory of https://github.com/facebook/zstd.
7 * An additional grant of patent rights can be found in the PATENTS file in the
8 * same directory.
10 * This program is free software; you can redistribute it and/or modify it under
11 * the terms of the GNU General Public License version 2 as published by the
12 * Free Software Foundation. This program is dual-licensed; you may select
13 * either version 2 of the GNU General Public License ("GPL") or BSD license
14 * ("BSD").
17 /* Note : this module is expected to remain private, do not expose it */
19 #ifndef ERROR_H_MODULE
20 #define ERROR_H_MODULE
22 /* ****************************************
23 * Dependencies
24 ******************************************/
25 #include <linux/types.h> /* size_t */
26 #include <linux/zstd.h> /* enum list */
28 /* ****************************************
29 * Compiler-specific
30 ******************************************/
31 #define ERR_STATIC static __attribute__((unused))
33 /*-****************************************
34 * Customization (error_public.h)
35 ******************************************/
36 typedef ZSTD_ErrorCode ERR_enum;
37 #define PREFIX(name) ZSTD_error_##name
39 /*-****************************************
40 * Error codes handling
41 ******************************************/
42 #define ERROR(name) ((size_t)-PREFIX(name))
44 ERR_STATIC unsigned ERR_isError(size_t code) { return (code > ERROR(maxCode)); }
46 ERR_STATIC ERR_enum ERR_getErrorCode(size_t code)
48 if (!ERR_isError(code))
49 return (ERR_enum)0;
50 return (ERR_enum)(0 - code);
53 #endif /* ERROR_H_MODULE */