aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/suricata/benches/ntohs.c
blob: c23dc3b0af2001c4ce9dab46c806af41668d2c04 (plain)
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
28
29
30
31
32
#include <stdlib.h>
#include <stdio.h>

int b=0;
int c=0;
char flag = 0;

#define PASS_A(a) flag & 0x01 ? c : (flag |= 0x01, c = ntohs(a))


int dosomething(int a) {
    return a;
}

int main() {
    int i = 0;
    int a = 1234;

    //for (i = 0; i < 100000000L; i++) {
    for (i = 0; i < 10; i++) {
        printf("PRE : a %d b %d c %d, flag %s\n", a,b,c, flag & 0x01 ? "SET":"NOT SET");

        a = dosomething(PASS_A(a));
        
        printf("POST: a %d b %d c %d, flag %s\n", a,b,c, flag & 0x01 ? "SET":"NOT SET");

//        a = ntohs(a);
    }

    exit(0);
}