How to check whether a system is big endian or little endian?

后端 未结 12 928
时光说笑
时光说笑 2020-11-28 20:25

How to check whether a system is big endian or little endian?

12条回答
  •  甜味超标
    2020-11-28 21:06

    In Rust (byteorder crate required):

    use std::any::TypeId;
    
    let is_little_endian = TypeId::of::() == TypeId::of::();
    

提交回复
热议问题