feat(util): add missing lbool.* files
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
0d7902f9eb
commit
7eb9496643
3 changed files with 34 additions and 1 deletions
|
@ -8,6 +8,6 @@ add_library(util trace.cpp debug.cpp name.cpp name_set.cpp name_generator.cpp
|
|||
exception.cpp interrupt.cpp hash.cpp escaped.cpp bit_tricks.cpp
|
||||
safe_arith.cpp ascii.cpp memory.cpp shared_mutex.cpp realpath.cpp
|
||||
script_state.cpp script_exception.cpp splay_map.cpp rb_map.cpp lua.cpp
|
||||
luaref.cpp stackinfo.cpp lean_path.cpp serializer.cpp ${THREAD_CPP})
|
||||
luaref.cpp stackinfo.cpp lean_path.cpp serializer.cpp lbool.cpp ${THREAD_CPP})
|
||||
|
||||
target_link_libraries(util ${LEAN_LIBS})
|
||||
|
|
16
src/util/lbool.cpp
Normal file
16
src/util/lbool.cpp
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
Copyright (c) 2014 Microsoft Corporation. All rights reserved.
|
||||
Released under Apache 2.0 license as described in the file LICENSE.
|
||||
|
||||
Author: Leonardo de Moura
|
||||
*/
|
||||
#include "util/lbool.h"
|
||||
namespace lean {
|
||||
std::ostream & operator<<(std::ostream & out, lbool b) {
|
||||
switch (b) {
|
||||
case l_false: return out << "l_false";
|
||||
case l_true: return out << "l_true";
|
||||
default: return out << "l_undef";
|
||||
}
|
||||
}
|
||||
}
|
17
src/util/lbool.h
Normal file
17
src/util/lbool.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
Copyright (c) 2014 Microsoft Corporation. All rights reserved.
|
||||
Released under Apache 2.0 license as described in the file LICENSE.
|
||||
|
||||
Author: Leonardo de Moura
|
||||
*/
|
||||
#pragma once
|
||||
#include <iostream>
|
||||
namespace lean {
|
||||
/**
|
||||
\brief lifted Booleans
|
||||
*/
|
||||
enum lbool { l_false = -1, l_undef, l_true };
|
||||
inline lbool operator~(lbool lb) { return static_cast<lbool>(-static_cast<int>(lb)); }
|
||||
inline lbool to_lbool(bool b) { return static_cast<lbool>(static_cast<int>(b)*2-1); }
|
||||
std::ostream & operator<<(std::ostream & out, lbool b);
|
||||
}
|
Loading…
Reference in a new issue