From: nishi Date: Sat, 18 May 2024 09:18:08 +0000 (+0000) Subject: finally it works X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=2bb1b2376efe0ff27c982e2a62980b9fe1fd910c;p=dataworks.git finally it works git-svn-id: file:///raid/svn-main/nishi-dataworks/trunk@25 d4a5a174-5a4a-5b4b-b672-37683c10d7d5 --- diff --git a/.clang-format b/.clang-format index a00b8c0..a5e838a 100644 --- a/.clang-format +++ b/.clang-format @@ -10,5 +10,6 @@ AllowShortIfStatementsOnASingleLine: Always AllowShortBlocksOnASingleLine: Never AllowShortLoopsOnASingleLine: true SpaceBeforeParens: Never +AlignEscapedNewlines: DontAlign StatementMacros: - __dw_big_endian diff --git a/Library/dw_util.h b/Library/dw_util.h index ad8c6fb..b95fcd4 100644 --- a/Library/dw_util.h +++ b/Library/dw_util.h @@ -49,23 +49,24 @@ bool __dw_strcaseequ(const char* a, const char* b); #define __dw_xstr(x) #x #define __dw_str(x) __dw_xstr(x) -#define __dw_big_endian(arg, type, exec) { \ - type __original = arg; \ - signed char* __ptr = (signed char*)&__original; \ - type __converted; \ - signed char* __converted_ptr = (signed char*)&__converted; \ - int __i; \ - int __endian_check = 1; \ - char __endian = (1 == *(volatile char*)&__endian_check) ? 'L' : 'B'; \ - for(__i = 0; __i < sizeof(type); __i++){ \ - if(__endian == 'L'){ \ - __converted_ptr[sizeof(type) - __i - 1] = __ptr[__i]; \ - }else{ \ - __converted_ptr[__i] = __ptr[__i]; \ +#define __dw_big_endian(arg, type, exec) \ + { \ + type __original = arg; \ + signed char* __ptr = (signed char*)&__original; \ + type __converted; \ + signed char* __converted_ptr = (signed char*)&__converted; \ + int __i; \ + int __endian_check = 1; \ + char __endian = (1 == *(volatile char*)&__endian_check) ? 'L' : 'B'; \ + for(__i = 0; __i < sizeof(type); __i++) { \ + if(__endian == 'L') { \ + __converted_ptr[sizeof(type) - __i - 1] = __ptr[__i]; \ + } else { \ + __converted_ptr[__i] = __ptr[__i]; \ + } \ } \ - } \ - exec; \ -} + exec; \ + } #ifdef __cplusplus }