请使用按位取反ba_not和加法ba_add实现两个数的减法输入两个数返回这两个数相减的值 提示 你可以使用int_to_ba_8函数获得常数1的bit_array表示ba8_t ba8_subba8_t a ba8_t b int tmp8 = 0 0 0 0 0 0 0 1 ; ba8_t ba_one = init_ba8tmp; TODO add you cod
ba8_t ba8_sub(ba8_t a, ba8_t b) { int tmp[8] = { 0, 0, 0, 0, 0, 0, 0, 1 }; ba8_t ba_one = init_ba8(tmp); ba8_t ba_b_not = ba_not(b); ba8_t ba_temp = ba_add(a, ba_b_not); ba8_t res = ba_add(ba_temp, ba_one); return res; }
原文地址: https://www.cveoy.top/t/topic/cNWe 著作权归作者所有。请勿转载和采集!