1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 14:28:07 +00:00

style: fix style according to new clang

[no changelog]
This commit is contained in:
Ondřej Vejpustek 2024-05-10 15:36:21 +02:00
parent f0fef1d8c1
commit 18f7820d47
14 changed files with 34 additions and 32 deletions

View File

@ -59,10 +59,10 @@
#define ATB_MASK_2 (0x30) #define ATB_MASK_2 (0x30)
#define ATB_MASK_3 (0xc0) #define ATB_MASK_3 (0xc0)
#define ATB_0_IS_FREE(a) (((a)&ATB_MASK_0) == 0) #define ATB_0_IS_FREE(a) (((a) & ATB_MASK_0) == 0)
#define ATB_1_IS_FREE(a) (((a)&ATB_MASK_1) == 0) #define ATB_1_IS_FREE(a) (((a) & ATB_MASK_1) == 0)
#define ATB_2_IS_FREE(a) (((a)&ATB_MASK_2) == 0) #define ATB_2_IS_FREE(a) (((a) & ATB_MASK_2) == 0)
#define ATB_3_IS_FREE(a) (((a)&ATB_MASK_3) == 0) #define ATB_3_IS_FREE(a) (((a) & ATB_MASK_3) == 0)
#define BLOCK_SHIFT(block) (2 * ((block) & (BLOCKS_PER_ATB - 1))) #define BLOCK_SHIFT(block) (2 * ((block) & (BLOCKS_PER_ATB - 1)))
#define ATB_GET_KIND(block) \ #define ATB_GET_KIND(block) \
@ -98,7 +98,7 @@
#define BLOCK_FROM_PTR(ptr) \ #define BLOCK_FROM_PTR(ptr) \
(((byte *)(ptr)-MP_STATE_MEM(gc_pool_start)) / BYTES_PER_BLOCK) (((byte *)(ptr)-MP_STATE_MEM(gc_pool_start)) / BYTES_PER_BLOCK)
#define PTR_FROM_BLOCK(block) \ #define PTR_FROM_BLOCK(block) \
(((block)*BYTES_PER_BLOCK + (uintptr_t)MP_STATE_MEM(gc_pool_start))) (((block) * BYTES_PER_BLOCK + (uintptr_t)MP_STATE_MEM(gc_pool_start)))
#define ATB_FROM_BLOCK(bl) ((bl) / BLOCKS_PER_ATB) #define ATB_FROM_BLOCK(bl) ((bl) / BLOCKS_PER_ATB)
// ptr should be of type void* // ptr should be of type void*

View File

@ -36,7 +36,9 @@
#include "display_interface.h" #include "display_interface.h"
static struct { int x, y; } DISPLAY_OFFSET; static struct {
int x, y;
} DISPLAY_OFFSET;
// common display functions // common display functions

View File

@ -139,7 +139,7 @@ font_glyph_iter_t font_glyph_iter_init(const int font, const uint8_t *text,
}; };
} }
#define IS_UTF8_CONTINUE(c) (((c)&0b11000000) == 0b10000000) #define IS_UTF8_CONTINUE(c) (((c) & 0b11000000) == 0b10000000)
static uint16_t next_utf8_codepoint(font_glyph_iter_t *iter) { static uint16_t next_utf8_codepoint(font_glyph_iter_t *iter) {
uint16_t out; uint16_t out;

View File

@ -7,8 +7,8 @@
#define USE_I2C 1 #define USE_I2C 1
#define USE_RGB_COLORS 1 #define USE_RGB_COLORS 1
#define USE_TOUCH 1 #define USE_TOUCH 1
//#define USE_SBU 1 // #define USE_SBU 1
//#define USE_DISP_I8080_8BIT_DW 1 // #define USE_DISP_I8080_8BIT_DW 1
#define USE_HASH_PROCESSOR 1 #define USE_HASH_PROCESSOR 1
#include "displays/dsi.h" #include "displays/dsi.h"

View File

@ -70,7 +70,7 @@ __IO DISP_MEM_TYPE *const DISPLAY_DATA_ADDRESS =
#endif #endif
#define DATA_TRANSFER(X) \ #define DATA_TRANSFER(X) \
DATA((X)&0xFF); \ DATA((X) & 0xFF); \
DATA((X) >> 8) DATA((X) >> 8)
__attribute__((section(".fb1"))) __attribute__((section(".fb1")))

View File

@ -55,7 +55,7 @@ void display_efficient_clear(void);
#define PIXELDATA(X) DATA(X) #define PIXELDATA(X) DATA(X)
#elif USE_DISP_I8080_8BIT_DW #elif USE_DISP_I8080_8BIT_DW
#define PIXELDATA(X) \ #define PIXELDATA(X) \
DATA((X)&0xFF); \ DATA((X) & 0xFF); \
DATA((X) >> 8) DATA((X) >> 8)
#endif #endif

View File

@ -681,8 +681,8 @@ typedef struct {
#define TS_INT_EXTI_IRQn EXTI8_IRQn #define TS_INT_EXTI_IRQn EXTI8_IRQn
/* Includes ------------------------------------------------------------------*/ /* Includes ------------------------------------------------------------------*/
//#include "stm32u5x9j_discovery_ts.h" // #include "stm32u5x9j_discovery_ts.h"
//#include "stm32u5x9j_discovery.h" // #include "stm32u5x9j_discovery.h"
/** @addtogroup BSP /** @addtogroup BSP
* @{ * @{

View File

@ -26,9 +26,9 @@
#define SAU_INIT_CTRL_ENABLE 1 #define SAU_INIT_CTRL_ENABLE 1
#define SAU_INIT_CTRL_ALLNS 0 #define SAU_INIT_CTRL_ALLNS 0
#define SAU_INIT_REGION(n, start, end, sec) \ #define SAU_INIT_REGION(n, start, end, sec) \
SAU->RNR = ((n)&SAU_RNR_REGION_Msk); \ SAU->RNR = ((n) & SAU_RNR_REGION_Msk); \
SAU->RBAR = ((start)&SAU_RBAR_BADDR_Msk); \ SAU->RBAR = ((start) & SAU_RBAR_BADDR_Msk); \
SAU->RLAR = ((end)&SAU_RLAR_LADDR_Msk) | \ SAU->RLAR = ((end) & SAU_RLAR_LADDR_Msk) | \
(((sec) << SAU_RLAR_NSC_Pos) & SAU_RLAR_NSC_Msk) | 1U (((sec) << SAU_RLAR_NSC_Pos) & SAU_RLAR_NSC_Msk) | 1U
static void trustzone_configure_sau(void) { static void trustzone_configure_sau(void) {

View File

@ -33,7 +33,7 @@
// block_count blocks of hash function in derivation_function. There is no need // block_count blocks of hash function in derivation_function. There is no need
// the input to have this length, it's just an optimalization. // the input to have this length, it's just an optimalization.
#define CHACHA_DRBG_OPTIMAL_RESEED_LENGTH(block_count) \ #define CHACHA_DRBG_OPTIMAL_RESEED_LENGTH(block_count) \
((block_count)*SHA256_BLOCK_LENGTH - 1 - 4 - 9) ((block_count) * SHA256_BLOCK_LENGTH - 1 - 4 - 9)
// 1 = sizeof(counter), 4 = sizeof(output_length) in // 1 = sizeof(counter), 4 = sizeof(output_length) in
// derivation_function, 9 is length of SHA256 padding of message // derivation_function, 9 is length of SHA256 padding of message
// aligned to bytes // aligned to bytes

View File

@ -68,11 +68,11 @@ static inline uint64_t mul128(uint64_t multiplier, uint64_t multiplicand,
} }
#define SWAP64(x) \ #define SWAP64(x) \
((((uint64_t)(x)&0x00000000000000ff) << 56) | \ ((((uint64_t)(x) & 0x00000000000000ff) << 56) | \
(((uint64_t)(x)&0x000000000000ff00) << 40) | \ (((uint64_t)(x) & 0x000000000000ff00) << 40) | \
(((uint64_t)(x)&0x0000000000ff0000) << 24) | \ (((uint64_t)(x) & 0x0000000000ff0000) << 24) | \
(((uint64_t)(x)&0x00000000ff000000) << 8) | \ (((uint64_t)(x) & 0x00000000ff000000) << 8) | \
(((uint64_t)(x)&0x000000ff00000000) >> 8) | \ (((uint64_t)(x) & 0x000000ff00000000) >> 8) | \
(((uint64_t)(x)&0x0000ff0000000000) >> 24) | \ (((uint64_t)(x) & 0x0000ff0000000000) >> 24) | \
(((uint64_t)(x)&0x00ff000000000000) >> 40) | \ (((uint64_t)(x) & 0x00ff000000000000) >> 40) | \
(((uint64_t)(x)&0xff00000000000000) >> 56)) (((uint64_t)(x) & 0xff00000000000000) >> 56))

View File

@ -16,7 +16,7 @@ int xmr_size_varint(uint64_t num) {
int xmr_write_varint(uint8_t *buff, size_t buff_size, uint64_t num) { int xmr_write_varint(uint8_t *buff, size_t buff_size, uint64_t num) {
unsigned ctr = 0; unsigned ctr = 0;
while (num >= 0x80 && ctr < buff_size) { while (num >= 0x80 && ctr < buff_size) {
*buff = (uint8_t)(((num)&0x7f) | 0x80); *buff = (uint8_t)(((num) & 0x7f) | 0x80);
++buff; ++buff;
++ctr; ++ctr;
num >>= 7; num >>= 7;

View File

@ -159,7 +159,7 @@ static void hash_rlp_number(uint64_t number) {
data[4] = (number >> 24) & 0xff; data[4] = (number >> 24) & 0xff;
data[5] = (number >> 16) & 0xff; data[5] = (number >> 16) & 0xff;
data[6] = (number >> 8) & 0xff; data[6] = (number >> 8) & 0xff;
data[7] = (number)&0xff; data[7] = (number) & 0xff;
int offset = 0; int offset = 0;
while (!data[offset]) { while (!data[offset]) {
offset++; offset++;

View File

@ -112,7 +112,7 @@ static uint8_t word_matrix[9];
* prefix length or table for the very first level, as the prefix length * prefix length or table for the very first level, as the prefix length
* is always one and there are always nine choices on the second level. * is always one and there are always nine choices on the second level.
*/ */
#define MASK_IDX(x) ((x)&0xfff) #define MASK_IDX(x) ((x) & 0xfff)
#define TABLE1(x) MASK_IDX(word_table1[x]) #define TABLE1(x) MASK_IDX(word_table1[x])
#define TABLE2(x) MASK_IDX(word_table2[x]) #define TABLE2(x) MASK_IDX(word_table2[x])

View File

@ -36,10 +36,10 @@ typedef uint32_t flash_block_t[FLASH_BLOCK_WORDS];
#if FLASH_BLOCK_WORDS == 1 #if FLASH_BLOCK_WORDS == 1
#define FLASH_ALIGN(X) (((X) + 3) & ~3) #define FLASH_ALIGN(X) (((X) + 3) & ~3)
#define FLASH_IS_ALIGNED(X) (((X)&3) == 0) #define FLASH_IS_ALIGNED(X) (((X) & 3) == 0)
#elif FLASH_BLOCK_WORDS == 4 #elif FLASH_BLOCK_WORDS == 4
#define FLASH_ALIGN(X) (((X) + 0xF) & ~0xF) #define FLASH_ALIGN(X) (((X) + 0xF) & ~0xF)
#define FLASH_IS_ALIGNED(X) (((X)&0xF) == 0) #define FLASH_IS_ALIGNED(X) (((X) & 0xF) == 0)
#else #else
#error Unsupported number of FLASH_BLOCK_WORDS. #error Unsupported number of FLASH_BLOCK_WORDS.
#endif #endif