[PATCH] D67926: Fix endianness handling in AVR MC

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 23 13:36:37 PDT 2019


efriedma added a comment.

This is still wrong.  The problem isn't the explicit swap that's being changed; it's the reinterpret_cast which implicitly depends on endianness (and breaks strict aliasing).

Probably clearer to explicitly write out the conversion from uint64_t explicitly.  For example, instead of `uint16_t Word = Words[i];`, instead write `uint16_t Word = (uint16_t)(Val >> (WordCount * 16));`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67926/new/

https://reviews.llvm.org/D67926





More information about the llvm-commits mailing list