URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 107 |
Rev 1765 |
|
|
struct Foo {
|
struct Foo {
|
union {
|
union {
|
int zero;
|
int zero;
|
unsigned int one;
|
unsigned int one;
|
} num1;
|
} num1;
|
struct X {
|
struct X {
|
int rock;
|
int rock;
|
unsigned int rock2;
|
unsigned int rock2;
|
};
|
};
|
union {
|
union {
|
int pebble;
|
int pebble;
|
X x;
|
X x;
|
union {
|
union {
|
int qux;
|
int qux;
|
unsigned int mux;
|
unsigned int mux;
|
};
|
};
|
unsigned int boulder;
|
unsigned int boulder;
|
};
|
};
|
union {
|
union {
|
int paper;
|
int paper;
|
unsigned int cloth;
|
unsigned int cloth;
|
};
|
};
|
union {
|
union {
|
int two;
|
int two;
|
unsigned int three;
|
unsigned int three;
|
} num2;
|
} num2;
|
};
|
};
|
|
|
union Bar {
|
union Bar {
|
int x;
|
int x;
|
unsigned int y;
|
unsigned int y;
|
};
|
};
|
|
|
|
|
int main()
|
int main()
|
{
|
{
|
Foo foo = {0, 0};
|
Foo foo = {0, 0};
|
|
|
foo.paper = 33;
|
foo.paper = 33;
|
foo.pebble = 44;
|
foo.pebble = 44;
|
foo.mux = 55;
|
foo.mux = 55;
|
|
|
Bar bar = {0};
|
Bar bar = {0};
|
|
|
union {
|
union {
|
int z;
|
int z;
|
unsigned int w;
|
unsigned int w;
|
}; w = 0;
|
}; w = 0;
|
|
|
bar.x = 33;
|
bar.x = 33;
|
|
|
w = 45;
|
w = 45;
|
|
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.