Enable 64-bit build on Linux & Mac
This commit is contained in:
parent
f2aa3c75ae
commit
ac6828f4fa
10
Makefile
10
Makefile
@ -13,12 +13,20 @@ endif
|
||||
# Configurations
|
||||
ifeq ($(BUILDTYPE), Release)
|
||||
CFLAGS += -O3
|
||||
ifneq ($(ENABLE64BIT), Yes)
|
||||
USE_ASM = Yes
|
||||
endif
|
||||
else
|
||||
CFLAGS = -g
|
||||
USE_ASM = No
|
||||
endif
|
||||
|
||||
ifeq ($(ENABLE64BIT), Yes)
|
||||
CFLAGS += -m64
|
||||
LDFLAGS += -m64
|
||||
else
|
||||
CFLAGS += -m32
|
||||
LDFLAGS += -m32
|
||||
endif
|
||||
include build/platform-$(UNAME).mk
|
||||
|
||||
ifeq ($(USE_ASM),Yes)
|
||||
|
@ -1,5 +1,5 @@
|
||||
USE_ASM = No # We don't have ASM working on Mac yet
|
||||
ASM = nasm
|
||||
CFLAGS += -arch i386 -fPIC
|
||||
LDFLAGS += -arch i386 -ldl -lpthread
|
||||
CFLAGS += -fPIC
|
||||
LDFLAGS += -ldl -lpthread
|
||||
ASMFLAGS += -f macho --prefix _
|
||||
|
@ -1,5 +1,5 @@
|
||||
ASM = nasm
|
||||
CFLAGS += -m32 -fPIC -DLINUX -D__NO_CTYPE
|
||||
LDFLAGS += -m32 -ldl -lpthread
|
||||
CFLAGS += -fPIC -DLINUX -D__NO_CTYPE
|
||||
LDFLAGS += -ldl -lpthread
|
||||
ASMFLAGS += -f elf
|
||||
|
||||
|
@ -57,14 +57,14 @@ namespace WelsDec {
|
||||
*/
|
||||
#define FORCE_STACK_ALIGN_1D(_tp, _nm, _sz, _al) \
|
||||
_tp _nm ## _tEmP[(_sz)+(_al)-1]; \
|
||||
_tp *_nm = _nm ## _tEmP + ((_al)-1) - (((int32_t)(_nm ## _tEmP + ((_al)-1)) & ((_al)-1))/sizeof(_tp))
|
||||
_tp *_nm = _nm ## _tEmP + ((_al)-1) - (((uintptr_t)(_nm ## _tEmP + ((_al)-1)) & ((_al)-1))/sizeof(_tp))
|
||||
|
||||
|
||||
#define ENFORCE_STACK_ALIGN_2D(_tp, _nm, _cx, _cy, _al) \
|
||||
assert( ((_al) && !((_al) & ((_al) - 1))) && ((_al) >= sizeof(_tp)) ); /*_al should be power-of-2 and >= sizeof(_tp)*/\
|
||||
_tp _nm ## _tEmP[(_cx)*(_cy)+(_al)/sizeof(_tp)-1]; \
|
||||
_tp *_nm ## _tEmP_al = _nm ## _tEmP + ((_al)/sizeof(_tp)-1); \
|
||||
_nm ## _tEmP_al -= (((int32_t)_nm ## _tEmP_al & ((_al)-1))/sizeof(_tp)); \
|
||||
_nm ## _tEmP_al -= (((uintptr_t)_nm ## _tEmP_al & ((_al)-1))/sizeof(_tp)); \
|
||||
_tp (*_nm)[(_cy)] = (_tp (*)[(_cy)])_nm ## _tEmP_al;
|
||||
|
||||
|
||||
|
@ -86,7 +86,7 @@ uint8_t* DetectStartCodePrefix (const uint8_t* kpBuf, int32_t* pOffset, int32_t
|
||||
++ pBits;
|
||||
|
||||
if ((iIdx >= 3) && ((* (pBits - 1)) == 0x1)) {
|
||||
*pOffset = ((uint32_t)pBits) - ((uint32_t)kpBuf);
|
||||
*pOffset = ((uintptr_t)pBits) - ((uintptr_t)kpBuf);
|
||||
return pBits;
|
||||
}
|
||||
|
||||
@ -970,4 +970,4 @@ int32_t ResetFmoList (PWelsDecoderContext pCtx) {
|
||||
return iCountNum;
|
||||
}
|
||||
|
||||
} // namespace WelsDec
|
||||
} // namespace WelsDec
|
||||
|
@ -84,7 +84,7 @@ void_t* WelsMalloc (const uint32_t kuiSize, const str_t* kpTag) {
|
||||
memset (pBuf, 0, kuiSize + kiAlignBytes + kiSizeVoidPtr + kiSizeInt);
|
||||
|
||||
pAlignBuf = pBuf + kiAlignBytes + kiSizeVoidPtr + kiSizeInt;
|
||||
pAlignBuf -= (int32_t) pAlignBuf & kiAlignBytes;
|
||||
pAlignBuf -= (uintptr_t) pAlignBuf & kiAlignBytes;
|
||||
* ((void_t**) (pAlignBuf - kiSizeVoidPtr)) = pBuf;
|
||||
* ((int32_t*) (pAlignBuf - (kiSizeVoidPtr + kiSizeInt))) = kuiSize;
|
||||
|
||||
|
@ -67,7 +67,7 @@
|
||||
assert( ((_al) && !((_al) & ((_al) - 1))) && ((_al) >= sizeof(_tp)) ); /*_al should be power-of-2 and >= sizeof(_tp)*/\
|
||||
_tp _nm ## _tEmP[(_sz)+(_al)/sizeof(_tp)-1]; \
|
||||
_tp *_nm = _nm ## _tEmP + ((_al)/sizeof(_tp)-1); \
|
||||
_nm -= (((int32_t)_nm & ((_al)-1))/sizeof(_tp));
|
||||
_nm -= (((uintptr_t)_nm & ((_al)-1))/sizeof(_tp));
|
||||
|
||||
/*
|
||||
* ENFORCE_STACK_ALIGN_2D: force 2 dimension local pData aligned in stack
|
||||
@ -90,7 +90,7 @@ _nm -= (((int32_t)_nm & ((_al)-1))/sizeof(_tp));
|
||||
assert( ((_al) && !((_al) & ((_al) - 1))) && ((_al) >= sizeof(_tp)) ); /*_al should be power-of-2 and >= sizeof(_tp)*/\
|
||||
_tp _nm ## _tEmP[(_cx)*(_cy)+(_al)/sizeof(_tp)-1]; \
|
||||
_tp *_nm ## _tEmP_al = _nm ## _tEmP + ((_al)/sizeof(_tp)-1); \
|
||||
_nm ## _tEmP_al -= (((int32_t)_nm ## _tEmP_al & ((_al)-1))/sizeof(_tp)); \
|
||||
_nm ## _tEmP_al -= (((uintptr_t)_nm ## _tEmP_al & ((_al)-1))/sizeof(_tp)); \
|
||||
_tp (*_nm)[(_cy)] = (_tp (*)[(_cy)])_nm ## _tEmP_al;
|
||||
|
||||
/*
|
||||
|
@ -111,7 +111,7 @@ void* CMemoryAlign::WelsMalloc (const uint32_t kuiSize, const str_t* kpTag) {
|
||||
return NULL;
|
||||
|
||||
pAlignedBuffer = pBuf + kiAlignedBytes + kiSizeOfVoidPointer + kiSizeOfInt;
|
||||
pAlignedBuffer -= ((int32_t) pAlignedBuffer & kiAlignedBytes);
|
||||
pAlignedBuffer -= ((uintptr_t) pAlignedBuffer & kiAlignedBytes);
|
||||
* ((void**) (pAlignedBuffer - kiSizeOfVoidPointer)) = pBuf;
|
||||
* ((int32_t*) (pAlignedBuffer - (kiSizeOfVoidPointer + kiSizeOfInt))) = kiPayloadSize;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user