Update instructions in containers.rst
[gromacs.git] / src / external / tng_io / include / compression / fixpoint.h
blob7b6a66725ef8dd73365dfea1f2d74faa7f1802fb
1 /* This code is part of the tng compression routines.
3 * Written by Daniel Spangberg
4 * Copyright (c) 2010, 2013, The GROMACS development team.
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the Revised BSD License.
9 */
11 #ifndef FIXPOINT_H
12 #define FIXPOINT_H
14 #include "../compression/my64bit.h"
16 /* There are at least 32 bits available in a long. */
17 typedef unsigned long fix_t;
19 /* Positive double to 32 bit fixed point value */
20 fix_t Ptngc_ud_to_fix_t(double d, const double max);
22 /* double to signed 32 bit fixed point value */
23 fix_t Ptngc_d_to_fix_t(double d, const double max);
25 /* 32 bit fixed point value to positive double */
26 double Ptngc_fix_t_to_ud(fix_t f, const double max);
28 /* signed 32 bit fixed point value to double */
29 double Ptngc_fix_t_to_d(fix_t f, const double max);
31 /* Convert a floating point variable to two 32 bit integers with range
32 -2.1e9 to 2.1e9 and precision to somewhere around 1e-9. */
33 void Ptngc_d_to_i32x2(double d, fix_t *hi, fix_t *lo);
35 /* Convert two 32 bit integers to a floating point variable
36 -2.1e9 to 2.1e9 and precision to somewhere around 1e-9. */
37 double Ptngc_i32x2_to_d(fix_t hi, fix_t lo);
39 #endif