Debian Codegraph @

src/ImathTest/testSize.cpp

raw
1 //
2 // SPDX-License-Identifier: BSD-3-Clause
3 // Copyright Contributors to the OpenEXR Project.
4 //
5
6 #ifdef NDEBUG
7 # undef NDEBUG
8 #endif
9
10 #include "half.h"
11 #include <assert.h>
12 #include <iostream>
13 #include <stddef.h>
14 #include "testSize.h"
15
16 using namespace std;
17
18 void
19 testSize()
20 {
21 cout << "size and alignment\n";
22
23 half h[2];
24
25 int size = sizeof (half);
26 ptrdiff_t algn = (char*) &h[1] - (char*) &h[0];
27
28 cout << "sizeof (half) = " << size << endl;
29 cout << "alignof (half) = " << (int) algn << endl;
30
31 assert (size == 2 && algn == 2);
32
33 cout << "ok\n\n" << flush;
34 }