Skip to content

Commit

Permalink
fix clang_icelake unaligned short
Browse files Browse the repository at this point in the history
  • Loading branch information
akhinvasara-jumptrading committed Feb 7, 2025
1 parent 14e93e0 commit 284793a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/waltz/tls/fd_tls_proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,9 @@ fd_tls_encode_client_hello( fd_tls_client_hello_t const * in,
# undef FIELDS
}

*extension_tot_sz = fd_ushort_bswap( (ushort)( (ulong)wire_laddr - extension_start ) );

ushort ext_tot_sz_tmp = fd_ushort_bswap( (ushort)( (ulong)wire_laddr - extension_start ) );
fd_memcpy( extension_tot_sz, &ext_tot_sz_tmp, sizeof(ushort) );
return (long)( wire_laddr - (ulong)wire );
}

Expand Down
11 changes: 8 additions & 3 deletions src/waltz/tls/fd_tls_serde.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,15 @@
do { \
uchar * dest = (uchar *)_field_##IDX##_laddr; \
memcpy( dest, (FIELD), _field_##IDX##_sz ); \
FIELD_TYPE * ele = fd_type_pun( dest ); \
for( ulong i=0; i<(FIELD_CNT); i++ ) { \
*ele = fd_##FIELD_TYPE##_bswap( *ele ); \
ele++; \
const ulong shared_offset = i*sizeof(FIELD_TYPE); \
if( sizeof(FIELD_TYPE) > 1 ) { \
ulong limit = (sizeof(FIELD_TYPE)>>1); \
for( ulong j = 0; j < limit; j++ ) { \
fd_swap( dest[shared_offset+j], \
dest[shared_offset+sizeof(FIELD_TYPE)-1-j]); \
} \
} \
} \
} while(0);

Expand Down

0 comments on commit 284793a

Please sign in to comment.