Carry flag macros for C: различия между версиями

Материал из fidoman.ru
(Новая страница: «== Macros of inline functions for integer addition and subtracion with respect of carry flag == bool cadd(lvalue, rvalue1, rvalue2) // rvalue1+rvalue2 -> lvalue,...»)
(нет различий)

Версия 18:21, 19 декабря 2021

Macros of inline functions for integer addition and subtracion with respect of carry flag

bool cadd(lvalue, rvalue1, rvalue2) // rvalue1+rvalue2 -> lvalue, returns true if there was carry bool csub(lvalue, rvalue1, rvalue2) // rvalue1-rvalue2 -> lvalue, returns true if there was borrow bool cadc(lvalue, rvalue1, rvalue2, rvalue_c) // rvalue1+rvalue2+c -> lvalue, returns true if there was carry bool csbb(lvalue, rvalue1, rvalue2, rvalue_b) // rvalue1-rvalue2-b -> lvalue, returns true if there was borrow

And also for shift operations

bool rlc // rotate through carry bool rrc bool shl // shift with outmove bit to carry bool shr

bool rol // rolling with outmove (duplicate bit to carry and to bit on side from which bits are moved) bool ror