OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.benjamin/] [bool02.C] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 305 jeremybenn
// { dg-do run  }
2
//980324 bkoz
3
//test for bool and bitwise ands
4
 
5
#include 
6
 
7
 
8
void bar ( bool  x ) {}
9
void bars ( short  x ) {}
10
 
11
#if 0
12
int andb(){
13
  bool y;
14
  bar ( y );
15
  int blob = ( 27 & int (y) );
16
  return blob; //expect 1 or 0
17
}
18
#endif
19
 
20
int andbtrue(){
21
  bool y = true;
22
  bar ( y );
23
  int blob = ( 27 & int (y) );
24
  return blob; //expect 1
25
}
26
 
27
int andbfalse(){
28
  bool y = false;
29
  bar ( y );
30
  int blob = ( 27 & int (y) );
31
  return blob; //expect 0
32
}
33
 
34
int andbfalse2(){
35
  bool y = 0;
36
  bar ( y );
37
  int blob = ( 27 & int (y) );
38
  return blob;  //expect 0
39
}
40
 
41
int ands(){
42
  short y = 1;
43
  bars ( y );
44
  int blob = ( 27 & int (y) );
45
  return blob;  //expect 1
46
}
47
 
48
 
49
int main() {
50
  int tmp;
51
#if 0
52
  tmp = andb();
53
  assert (tmp == 1 || tmp == 0);
54
#endif
55
  tmp = andbtrue();
56
  assert (tmp == 1);
57
  tmp = andbfalse();
58
  assert (tmp == 0);
59
  tmp = andbfalse2();
60
  assert (tmp == 0);
61
  tmp = ands();
62
  assert (tmp == 1);
63
  return 0;
64
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.