bh_leb128.h 589 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * Copyright (C) 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #ifndef _BH_LEB128_H
  6. #define _BH_LEB128_H
  7. #include "bh_platform.h"
  8. typedef enum {
  9. BH_LEB_READ_SUCCESS,
  10. BH_LEB_READ_TOO_LONG,
  11. BH_LEB_READ_OVERFLOW,
  12. BH_LEB_READ_UNEXPECTED_END,
  13. } bh_leb_read_status_t;
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. bh_leb_read_status_t
  18. bh_leb_read(const uint8 *buf, const uint8 *buf_end, uint32 maxbits, bool sign,
  19. uint64 *p_result, size_t *p_offset);
  20. #ifdef __cplusplus
  21. }
  22. #endif
  23. #endif