__unaligned

本文介绍在针对Itanium处理器家族(IPF)计算机的应用程序中,如何通过使用__unaligned修饰符使编译器生成的代码逐字节读取未对齐的数据,从而避免访问不均匀对齐数据时产生的性能减弱和异常情况。x64应用程序不需要此修饰符,因为x64处理器能够无故障地处理不均匀对齐的数据。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

When you declare a pointer with the __unaligned modifier, the compiler assumes that the pointer addresses data that is not aligned. Consequently, for an application that targets an Itanium Processor Family (IPF) computer, the compiler generates code that reads the unaligned data one byte at a time.

Remarks

The __unaligned modifier is valid for the x64 and Itanium compilers but affects only applications that target an IPF computer. This modifier describes the alignment of the addressed data only; the pointer itself is assumed to be aligned.

The Itanium processor generates an alignment fault when it accesses misaligned data, and the time to process the fault weakens performance. Use the __unaligned modifier to cause the processor to read data one byte at a time and avoid the fault. This modifier is not required for x64 applications because the x64 processor handles misaligned data without faulting. 

https://msdn.microsoft.com/en-us/library/ms177389.aspx


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值