File: testSize.cpp

package info (click to toggle)
openexr 1.2.2-4.3
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 15,508 kB
  • ctags: 3,410
  • sloc: cpp: 40,009; sh: 8,399; makefile: 345
file content (27 lines) | stat: -rw-r--r-- 456 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <testSize.h>
#include <half.h>
#include <iostream>
#include <assert.h>
#include <stddef.h>


using namespace std;


void
testSize ()
{
    cout << "size and alignment\n";

    half h[2];

    int size = sizeof (half);
    ptrdiff_t algn = (char *)&h[1] - (char *)&h[0];

    cout << "sizeof  (half) = " << size << endl;
    cout << "alignof (half) = " << (int) algn << endl;

    assert (size == 2 && algn == 2);

    cout << "ok\n\n" << flush;
}