C语言实现8位补码求相反数 - 利用按位取反和加法
ba8_t ba8_negate(ba8_t a) { int tmp[8] = { 0, 0, 0, 0, 0, 0, 0, 1 }; ba8_t ba_one = init_ba8(tmp); ba8_t ba_not_a = ba_not(a); ba8_t res = ba_add(ba_not_a, ba_one); return res; }
原文地址: https://www.cveoy.top/t/topic/nzGM 著作权归作者所有。请勿转载和采集!