File tree Expand file tree Collapse file tree
App-MHFS/share/public_html/static/music_worklet_inprogress/decoder/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// ExposeType: Expose constants, structs, and unions to js
22#pragma once
33#include <stddef.h>
4+ #include <stdint.h>
45#include <assert.h>
56
7+ #if defined(__SIZEOF_SIZE_T__ ) && defined(__SIZEOF_POINTER__ )
8+ #if __SIZEOF_SIZE_T__ >= __SIZEOF_POINTER__
9+ typedef size_t et_value ;
10+ #else
11+ typedef uintptr_t et_value ;
12+ #endif
13+ #else
14+ typedef size_t et_value ;
15+ static_assert (sizeof (et_value ) < sizeof (uintptr_t ), "et_value not big enough for pointer" );
16+ #endif
17+
618typedef enum {
719 ET_TT_CONST_IV = 1 ,
820 ET_TT_CONST_CSTRING = 2 ,
@@ -21,7 +33,7 @@ case 0: \
2133return XTYPE; \
2234break; \
2335case 1: \
24- return (uint64_t )#X; \
36+ return (et_value )#X; \
2537break; \
2638case 2: \
2739return X; \
@@ -39,7 +51,7 @@ case 0: \
3951return XTYPE; \
4052break; \
4153case 1: \
42- return (uint64_t )#XMEMBER; \
54+ return (et_value )#XMEMBER; \
4355break; \
4456case 2: \
4557return offsetof(XSTRUCT, XMEMBER); \
@@ -72,7 +84,7 @@ case 0: \
7284return ET_TT_ST; \
7385break; \
7486case 1: \
75- return (uint64_t )#X; \
87+ return (et_value )#X; \
7688break; \
7789case 2: \
7890return sizeof(X); \
Original file line number Diff line number Diff line change 99#endif
1010#include <stdint.h>
1111#include <stddef.h>
12+ #include "exposetype.h"
1213
1314// util
1415LIBEXPORT unsigned long mhfs_cl_djb2 (const uint8_t * pData , const size_t dataLen );
1516
1617// For JS convenience export types
17- LIBEXPORT uint64_t mhfs_cl_et_load_type (const uint32_t itemIndex , const uint32_t subItemIndex );
18+ LIBEXPORT et_value mhfs_cl_et_load_type (const uint32_t itemIndex , const uint32_t subItemIndex );
1819#endif /* mhfs_cl_misc_h */
1920
2021#if defined(MHFSCLMISC_IMPLEMENTATION )
2122#ifndef mhfs_cl_misc_c
2223#define mhfs_cl_misc_c
2324
24- #include "exposetype.h"
2525#include "mhfs_cl.h"
2626#include "mhfs_cl_track.h"
2727
@@ -35,7 +35,7 @@ unsigned long mhfs_cl_djb2(const uint8_t *pData, const size_t dataLen)
3535 return hash ;
3636}
3737
38- uint64_t mhfs_cl_et_load_type (const uint32_t itemIndex , const uint32_t subItemIndex )
38+ et_value mhfs_cl_et_load_type (const uint32_t itemIndex , const uint32_t subItemIndex )
3939{
4040 switch (itemIndex )
4141 {
You can’t perform that action at this time.
0 commit comments