Remove building with NOCRYPTO option
[minix.git] / crypto / external / bsd / openssl / dist / times / x86 / casts.cpp
blob7661191acf5ce02b64debf79622e01eeef8c03a3
1 //
2 // gettsc.inl
3 //
4 // gives access to the Pentium's (secret) cycle counter
5 //
6 // This software was written by Leonard Janke (janke@unixg.ubc.ca)
7 // in 1996-7 and is entered, by him, into the public domain.
9 #if defined(__WATCOMC__)
10 void GetTSC(unsigned long&);
11 #pragma aux GetTSC = 0x0f 0x31 "mov [edi], eax" parm [edi] modify [edx eax];
12 #elif defined(__GNUC__)
13 inline
14 void GetTSC(unsigned long& tsc)
16 asm volatile(".byte 15, 49\n\t"
17 : "=eax" (tsc)
19 : "%edx", "%eax");
21 #elif defined(_MSC_VER)
22 inline
23 void GetTSC(unsigned long& tsc)
25 unsigned long a;
26 __asm _emit 0fh
27 __asm _emit 31h
28 __asm mov a, eax;
29 tsc=a;
31 #endif
33 #include <stdio.h>
34 #include <stdlib.h>
35 #include <openssl/cast.h>
37 void main(int argc,char *argv[])
39 CAST_KEY key;
40 unsigned long s1,s2,e1,e2;
41 unsigned long data[2];
42 int i,j;
44 for (j=0; j<6; j++)
46 for (i=0; i<1000; i++) /**/
48 CAST_encrypt(&data[0],&key);
49 GetTSC(s1);
50 CAST_encrypt(&data[0],&key);
51 CAST_encrypt(&data[0],&key);
52 CAST_encrypt(&data[0],&key);
53 GetTSC(e1);
54 GetTSC(s2);
55 CAST_encrypt(&data[0],&key);
56 CAST_encrypt(&data[0],&key);
57 CAST_encrypt(&data[0],&key);
58 CAST_encrypt(&data[0],&key);
59 GetTSC(e2);
60 CAST_encrypt(&data[0],&key);
63 printf("cast %d %d (%d)\n",
64 e1-s1,e2-s2,((e2-s2)-(e1-s1)));