以下の内容はhttps://yohhoy.hatenadiary.jp/entry/20161101/p1より取得しました。


to be, or not to be?

Rust標準ライブラリのコメントより。整数型*1に対してBig Endianへの変換メソッドto_beが提供される。その他にもEndianness変換メソッドto_le, from_be, from_leが提供される。

pub fn to_be(self) -> Self { // or not to be?
  if cfg!(target_endian = "big") { self } else { self.swap_bytes() }
}
https://github.com/rust-lang/rust/blob/1.12.1/src/libcore/num/mod.rs#L428

関連URL

*1:i8, i16, i32, i64, isize, u8, u16, u32, u64, usize




以上の内容はhttps://yohhoy.hatenadiary.jp/entry/20161101/p1より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14