GCC Code Coverage Report
Directory: . Exec Total Coverage
File: build-coverage/deps/include/symfpu/core/sign.h Lines: 10 10 100.0 %
Date: 2021-09-18 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
772
  unpackedFloat<t> negate (const typename t::fpt &format, const unpackedFloat<t> &uf) {
27
28
772
  PRECONDITION(uf.valid(format));
29
30
772
  unpackedFloat<t> result(uf, !uf.getSign());
31
32
772
  POSTCONDITION(result.valid(format));
33
34
772
  return result;
35
 }
36
37
template <class t>
38
28
  unpackedFloat<t> absolute (const typename t::fpt &format, const unpackedFloat<t> &uf) {
39
40
28
  PRECONDITION(uf.valid(format));
41
42
28
  unpackedFloat<t> result(uf, typename t::prop(false));
43
44
28
  POSTCONDITION(result.valid(format));
45
46
28
  return result;
47
 }
48
49
50
}
51
52
#endif