はじめに ZACKYこと山崎進です。 整数の加減乗算のオーバーフローを検出する方法がわかりましたので,報告します。 「ZEAM開発ログ 目次」はこちら 整数のオーバーフローを検出する方法 __builtin_*_overflow という関数を使います。 符号付き64ビット整数だったら,__builtin_saddl_overflow になります。 ドキュメントはこちら。 Clang Language Extensions — Clang 4 documentation C言語のコードはこんな感じです。 static ERL_NIF_TERM asm_1_nif_ii(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]) { long a, b; if(__builtin_expect((enif_get_int64(env, argv[0
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く