Rizin
unix-like reverse engineering framework and cli tools
arm_il_common.inc
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2022 Florian Märkl <info@florianmaerkl.de>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
7 static RZ_OWN RzILOpBool *add_carry(RZ_OWN RzILOpBitVector *a, RZ_OWN RzILOpBitVector *b, bool with_carry, ut32 bits) {
8  RzILOpBitVector *r = ADD(UNSIGNED(bits + 1, a), UNSIGNED(bits + 1, b));
9  if (with_carry) {
10  r = ADD(r, ITE(VARG("cf"), UN(bits + 1, 1), UN(bits + 1, 0)));
11  }
12  return MSB(r);
13 }
14 
18 static RZ_OWN RzILOpBool *sub_carry(RZ_OWN RzILOpBitVector *a, RZ_OWN RzILOpBitVector *b, bool with_carry, ut32 bits) {
19  if (with_carry) {
20  return add_carry(a, LOGNOT(b), true, bits);
21  }
22  return ULE(b, a);
23 }
24 
29  return AND(INV(XOR(MSB(a), MSB(b))), XOR(MSB(DUP(a)), MSB(res)));
30 }
31 
36  return AND(XOR(MSB(a), MSB(b)), XOR(MSB(DUP(a)), MSB(res)));
37 }
int bits(struct state *s, int need)
Definition: blast.c:72
#define r
Definition: crypto_rc6.c:12
uint32_t ut32
#define AND
Definition: ansidecl.h:254
#define XOR
Definition: rsp_idec.c:212
#define ADD
Definition: rsp_idec.c:200
#define LOGNOT(x)
#define UN(l, val)
#define ULE(x, y)
#define INV(x)
#define ITE(c, t, f)
#define UNSIGNED(n, x)
#define MSB(x)
#define VARG(name)
#define RZ_OWN
Definition: rz_types.h:62
@ DUP
Definition: packet.c:12
#define b(i)
Definition: sha256.c:42
#define a(i)
Definition: sha256.c:41
An IL op performing a pure computation, 'a pure.