1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
/*
** Copyright (C) 2018 Martin Brain
**
** See the file LICENSE for licensing information.
*/
/*
** sign.h
**
** Martin Brain
** martin.brain@cs.ox.ac.uk
** 21/08/14
**
** The sign manipulating operations.
**
*/
#include "symfpu/core/unpackedFloat.h"
#ifndef SYMFPU_SIGN
#define SYMFPU_SIGN
namespace symfpu {
template <class t>
unpackedFloat<t> negate (const typename t::fpt &format, const unpackedFloat<t> &uf) {
PRECONDITION(uf.valid(format));
unpackedFloat<t> result(uf, !uf.getSign());
POSTCONDITION(result.valid(format));
return result;
}
template <class t>
unpackedFloat<t> absolute (const typename t::fpt &format, const unpackedFloat<t> &uf) {
PRECONDITION(uf.valid(format));
unpackedFloat<t> result(uf, typename t::prop(false));
POSTCONDITION(result.valid(format));
return result;
}
}
#endif
|