3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00

move out sign

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2020-01-19 09:34:22 -06:00
parent 89c91765f6
commit d3b105f9f8
15 changed files with 176 additions and 168 deletions

24
src/util/sign.h Normal file
View file

@ -0,0 +1,24 @@
/*++
Copyright (c) 2006 Microsoft Corporation
Module Name:
sign.h
Abstract:
Sign
Author:
Nikolaj Bjorner
--*/
#pragma once
typedef enum { sign_neg = -1, sign_zero = 0, sign_pos = 1} sign;
inline sign operator-(sign s) { switch (s) { case sign_neg: return sign_pos; case sign_pos: return sign_neg; default: return sign_zero; } };
inline sign to_sign(int s) { return s == 0 ? sign_zero : (s > 0 ? sign_pos : sign_neg); }
inline sign operator*(sign a, sign b) { return to_sign((int)a * (int)b); }
inline bool is_zero(sign s) { return s == sign_zero; }