]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/range.h
libstdc++: fix C header include guards
[thirdparty/gcc.git] / gcc / range.h
CommitLineData
38a73435 1/* Header file for misc range functions. -*- C++ -*-
a945c346 2 Copyright (C) 2017-2024 Free Software Foundation, Inc.
38a73435
AH
3 Contributed by Aldy Hernandez <aldyh@redhat.com>.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 3, or (at your option) any later
10version.
11
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
20
21#ifndef GCC_RANGE_H
22#define GCC_RANGE_H
23
6fb43d1b
AH
24int_range<2> range_positives (tree type);
25int_range<2> range_negatives (tree type);
9eb38e88
AH
26
27// Return an irange instance that is a boolean TRUE.
28
cb3e0eac 29inline int_range<1>
cb779afe 30range_true (tree type = boolean_type_node)
9eb38e88
AH
31{
32 unsigned prec = TYPE_PRECISION (type);
cb779afe 33 return int_range<1> (type, wi::one (prec), wi::one (prec));
9eb38e88
AH
34}
35
36// Return an irange instance that is a boolean FALSE.
37
cb3e0eac 38inline int_range<1>
cb779afe 39range_false (tree type = boolean_type_node)
9eb38e88
AH
40{
41 unsigned prec = TYPE_PRECISION (type);
cb779afe 42 return int_range<1> (type, wi::zero (prec), wi::zero (prec));
9eb38e88
AH
43}
44
45// Return an irange that covers both true and false.
46
cb3e0eac 47inline int_range<1>
cb779afe 48range_true_and_false (tree type = boolean_type_node)
9eb38e88
AH
49{
50 unsigned prec = TYPE_PRECISION (type);
d3296989 51 if (prec == 1)
cb779afe
AH
52 return int_range<1> (type);
53 return int_range<1> (type, wi::zero (prec), wi::one (prec));
9eb38e88
AH
54}
55
38a73435 56#endif // GCC_RANGE_H