monotone

monotone Mtn Source Tree

Root/botan/mp_asm.h

1/*************************************************
2* Lowest Level MPI Algorithms Header File *
3* (C) 1999-2008 The Botan Project *
4*************************************************/
5
6#ifndef BOTAN_MP_ASM_H__
7#define BOTAN_MP_ASM_H__
8
9#include <botan/mp_types.h>
10
11#if (BOTAN_MP_WORD_BITS == 8)
12 typedef Botan::u16bit dword;
13#elif (BOTAN_MP_WORD_BITS == 16)
14 typedef Botan::u32bit dword;
15#elif (BOTAN_MP_WORD_BITS == 32)
16 typedef Botan::u64bit dword;
17#elif (BOTAN_MP_WORD_BITS == 64)
18 #error BOTAN_MP_WORD_BITS can be 64 only with assembly support
19#else
20 #error BOTAN_MP_WORD_BITS must be 8, 16, 32, or 64
21#endif
22
23namespace Botan {
24
25extern "C" {
26
27/*************************************************
28* Word Multiply/Add *
29*************************************************/
30inline word word_madd2(word a, word b, word* c)
31 {
32 dword z = (dword)a * b + *c;
33 *c = (word)(z >> BOTAN_MP_WORD_BITS);
34 return (word)z;
35 }
36
37/*************************************************
38* Word Multiply/Add *
39*************************************************/
40inline word word_madd3(word a, word b, word c, word* d)
41 {
42 dword z = (dword)a * b + c + *d;
43 *d = (word)(z >> BOTAN_MP_WORD_BITS);
44 return (word)z;
45 }
46
47}
48
49}
50
51#endif

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status