从大到小末日迁移:如何预先确定有问题的代码?

发布于 2025-01-24 14:52:28 字数 171 浏览 3 评论 0原文

我将要将C代码(30+ KSLOC)的小型项目从32位的Big到32位的Little Endian平台迁移。我想检查坦德节,这将是多少工作,所以我想发现依赖原始Endianess的代码。

我正在寻找尽可能全面的C代码成语的集合,这取决于大恩迪安。不要打扰检测实际代码中这种成语所需的努力,我有一些代码分析工具支持。

I am about to migrate a small project of C code (30+ kSLOC) from a 32-bit big to a 32-bit little endian platform. I would like to check ante festum, how much work this will be, so I would like to spot code that relies on the original endianess.

I am looking for an as comprehensive as possible collection of C code idioms, which are depending on big endian. Do not bother with the effort needed to detect the use of such idioms in real code, I have some code analysis tool support available.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

幸福%小乖 2025-01-31 14:52:28

有些事情要注意:

  • 多种大小的整数类型之间的腥指针铸件和可恶的类型转换。这些也可能是潜在的对准或严格的混叠错误。
  • 序列化/de-Serialization代码,其中数据从/写入到字节数组中。
  • 数据通信界面没有序列化/de-Serialization代码。也就是说:CPU恰好与网络具有相同的Endianess,这对于大型末日系统来说是常见的。以太网,可以,uart等。
  • 带有位的结构。
  • 联合类型双关。

Some things to look out for:

  • Fishy pointer casts and fishy type conversions between integer types of different sizes. These may also be latent alignment or strict aliasing bugs.
  • Serialization/de-serialization code, where data is read from/written to byte arrays.
  • Data communication interfaces without serialization/de-serialization code. That is: CPU just happened to have same endianess as the network, which is common for big endian systems in particular. Ethernet, CAN, UART and so on.
  • Structs with bit-fields.
  • Union type punning.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文