GCC Code Coverage Report
Directory: . Exec Total Coverage
File: deps/install/include/symfpu/core/sign.h Lines: 10 10 100.0 %
Date: 2021-03-22 Branches: 10 18 55.6 %

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