2 /*+-----------------------------------------------------------------**
4 **-----------------------------------------------------------------**
6 **-----------------------------------------------------------------**
7 ** First version: 18/07/2011 **
8 **-----------------------------------------------------------------**
11 *****************************************************************************
12 * OpenScop: Structures and formats for polyhedral tools to talk together *
13 *****************************************************************************
14 * ,___,,_,__,,__,,__,,__,,_,__,,_,__,,__,,___,_,__,,_,__, *
15 * / / / // // // // / / / // // / / // / /|,_, *
16 * / / / // // // // / / / // // / / // / / / /\ *
17 * |~~~|~|~~~|~~~|~~~|~~~|~|~~~|~|~~~|~~~|~~~|~|~~~|~|~~~|/_/ \ *
18 * | G |C| P | = | L | P |=| = |C| = | = | = |=| = |=| C |\ \ /\ *
19 * | R |l| o | = | e | l |=| = |a| = | = | = |=| = |=| L | \# \ /\ *
20 * | A |a| l | = | t | u |=| = |n| = | = | = |=| = |=| o | |\# \ \ *
21 * | P |n| l | = | s | t |=| = |d| = | = | = | | |=| o | | \# \ \ *
22 * | H | | y | | e | o | | = |l| | | = | | | | G | | \ \ \ *
23 * | I | | | | e | | | | | | | | | | | | | \ \ \ *
24 * | T | | | | | | | | | | | | | | | | | \ \ \ *
25 * | E | | | | | | | | | | | | | | | | | \ \ \ *
26 * | * |*| * | * | * | * |*| * |*| * | * | * |*| * |*| * | / \* \ \ *
27 * | O |p| e | n | S | c |o| p |-| L | i | b |r| a |r| y |/ \ \ / *
28 * '---'-'---'---'---'---'-'---'-'---'---'---'-'---'-'---' '--' *
30 * Copyright (C) 2008 University Paris-Sud 11 and INRIA *
32 * (3-clause BSD license) *
33 * Redistribution and use in source and binary forms, with or without *
34 * modification, are permitted provided that the following conditions *
37 * 1. Redistributions of source code must retain the above copyright notice, *
38 * this list of conditions and the following disclaimer. *
39 * 2. Redistributions in binary form must reproduce the above copyright *
40 * notice, this list of conditions and the following disclaimer in the *
41 * documentation and/or other materials provided with the distribution. *
42 * 3. The name of the author may not be used to endorse or promote products *
43 * derived from this software without specific prior written permission. *
45 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR *
46 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES *
47 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. *
48 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, *
49 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT *
50 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
51 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
52 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
53 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF *
54 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
56 * OpenScop Library, a library to manipulate OpenScop formats and data *
57 * structures. Written by: *
58 * Cedric Bastoul <Cedric.Bastoul@u-psud.fr> and *
59 * Louis-Noel Pouchet <Louis-Noel.pouchet@inria.fr> *
61 *****************************************************************************/
65 # include <openscop/int.h>
68 /*+***************************************************************************
70 *****************************************************************************/
74 * openscop_int_dump_precision function:
75 * this function prints in a human readable fashion the precision
76 * corresponding to the "precision" parameter.
77 * \param[in] file The file where to print the precision.
78 * \param[in] precision The precision to print.
80 void openscop_int_dump_precision(FILE * file
, int precision
) {
83 case OPENSCOP_PRECISION_SP
:
84 fprintf(file
, "32 bits");
86 case OPENSCOP_PRECISION_DP
:
87 fprintf(file
, "64 bits");
89 #ifdef OPENSCOP_GMP_IS_HERE
90 case OPENSCOP_PRECISION_MP
:
95 fprintf(file
, "unknown precision %d", precision
);
100 int openscop_int_sizeof(int precision
) {
102 case OPENSCOP_PRECISION_SP
:
103 return sizeof(long int);
105 case OPENSCOP_PRECISION_DP
:
106 return sizeof(long long int);
108 #ifdef OPENSCOP_GMP_IS_HERE
109 case OPENSCOP_PRECISION_MP
:
110 return sizeof(mpz_t
);
114 OPENSCOP_error("unknown precision");
119 void * openscop_int_address(int precision
, void * base
, int offset
) {
121 case OPENSCOP_PRECISION_SP
:
122 return (long int *)base
+ offset
;
124 case OPENSCOP_PRECISION_DP
:
125 return (long long int *)base
+ offset
;
127 #ifdef OPENSCOP_GMP_IS_HERE
128 case OPENSCOP_PRECISION_MP
:
129 return (mpz_t
*)base
+ offset
;
133 OPENSCOP_error("unknown precision");
138 void openscop_int_init(int precision
, void * value_base
, int value_offset
) {
139 void * value
= openscop_int_address(precision
, value_base
, value_offset
);
142 case OPENSCOP_PRECISION_SP
:
143 *(long int *)value
= 0;
146 case OPENSCOP_PRECISION_DP
:
147 *(long long int *)value
= 0;
150 #ifdef OPENSCOP_GMP_IS_HERE
151 case OPENSCOP_PRECISION_MP
:
152 mpz_init(*(mpz_t
*)value
);
157 OPENSCOP_error("unknown precision");
162 void * openscop_int_malloc(int precision
) {
166 case OPENSCOP_PRECISION_SP
:
167 value
= malloc(sizeof(long int));
170 case OPENSCOP_PRECISION_DP
:
171 value
= malloc(sizeof(long long int));
172 *(long long int *)value
= 0;
175 #ifdef OPENSCOP_GMP_IS_HERE
176 case OPENSCOP_PRECISION_MP
:
177 value
= malloc(sizeof(mpz_t
));
182 OPENSCOP_error("unknown precision");
185 openscop_int_init(precision
, value
, 0);
190 void openscop_int_assign(int precision
,
191 void * val1_base
, int val1_offset
,
192 void * val2_base
, int val2_offset
) {
193 void * val1
= openscop_int_address(precision
, val1_base
, val1_offset
);
194 void * val2
= openscop_int_address(precision
, val2_base
, val2_offset
);
197 case OPENSCOP_PRECISION_SP
:
198 *(long int *)val1
= *(long int *)val2
;
201 case OPENSCOP_PRECISION_DP
:
202 *(long long int *)val1
= *(long long int *)val2
;
205 #ifdef OPENSCOP_GMP_IS_HERE
206 case OPENSCOP_PRECISION_MP
:
207 mpz_set(*(mpz_t
*)val1
, *(mpz_t
*)val2
);
212 OPENSCOP_error("unknown precision");
217 void openscop_int_set_si(int precision
, void * value_base
, int value_offset
,
219 void * value
= openscop_int_address(precision
, value_base
, value_offset
);
222 case OPENSCOP_PRECISION_SP
:
223 *(long int *)value
= (long int)i
;
226 case OPENSCOP_PRECISION_DP
:
227 *(long long int *)value
= (long long int)i
;
230 #ifdef OPENSCOP_GMP_IS_HERE
231 case OPENSCOP_PRECISION_MP
:
232 mpz_set_si(*(mpz_t
*)value
, i
);
237 OPENSCOP_error("unknown precision");
242 int openscop_int_get_si(int precision
, void * value_base
, int value_offset
) {
243 void * value
= openscop_int_address(precision
, value_base
, value_offset
);
246 case OPENSCOP_PRECISION_SP
:
247 return *(int *)value
;
249 case OPENSCOP_PRECISION_DP
:
250 return *(int *)value
;
252 #ifdef OPENSCOP_GMP_IS_HERE
253 case OPENSCOP_PRECISION_MP
:
254 return mpz_get_si(*(mpz_t
*)value
);
258 OPENSCOP_error("unknown precision");
263 void openscop_int_init_set_si(int precision
,
264 void * value_base
, int value_offset
, int i
) {
265 void * value
= openscop_int_address(precision
, value_base
, value_offset
);
268 case OPENSCOP_PRECISION_SP
:
269 *(long int *)value
= (long int)i
;
272 case OPENSCOP_PRECISION_DP
:
273 *(long long int *)value
= (long long int)i
;
276 #ifdef OPENSCOP_GMP_IS_HERE
277 case OPENSCOP_PRECISION_MP
:
278 mpz_init_set_si(*(mpz_t
*)value
, i
);
283 OPENSCOP_error("unknown precision");
288 void openscop_int_clear(int precision
, void * value_base
, int value_offset
) {
289 void * value
= openscop_int_address(precision
, value_base
, value_offset
);
292 case OPENSCOP_PRECISION_SP
:
293 *(long int *)value
= 0;
296 case OPENSCOP_PRECISION_DP
:
297 *(long long int *)value
= 0;
300 #ifdef OPENSCOP_GMP_IS_HERE
301 case OPENSCOP_PRECISION_MP
:
302 mpz_clear(*(mpz_t
*)value
);
307 OPENSCOP_error("unknown precision");
312 void openscop_int_free(int precision
, void * value_base
, int value_offset
) {
313 void * value
= openscop_int_address(precision
, value_base
, value_offset
);
315 openscop_int_clear(precision
, value_base
, value_offset
);
321 * openscop_int_print function:
322 * this function displays an integer value into a file (file, possibly stdout).
323 * \param file The file where the integer has to be printed.
324 * \param precision The precision of the integer.
325 * \param value Address of the integer value.
327 void openscop_int_print(FILE * file
, int precision
,
328 void * value_base
, int value_offset
) {
329 void * value
= openscop_int_address(precision
, value_base
, value_offset
);
332 case OPENSCOP_PRECISION_SP
:
333 fprintf(file
, OPENSCOP_FMT_SP
, *(long int *)value
);
336 case OPENSCOP_PRECISION_DP
:
337 fprintf(file
, OPENSCOP_FMT_DP
, *(long long int *)value
);
340 #ifdef OPENSCOP_GMP_IS_HERE
341 case OPENSCOP_PRECISION_MP
: {
343 str
= mpz_get_str(0, 10, *(mpz_t
*)value
); //TODO: 10 -> #define
344 fprintf(file
, OPENSCOP_FMT_MP
, str
);
351 OPENSCOP_error("unknown precision");
357 * openscop_int_sprint function:
358 * this function prints an integer value into a string.
359 * \param string The string where the integer has to be printed.
360 * \param precision The precision of the integer.
361 * \param value Address of the integer value.
363 void openscop_int_sprint(char * string
, int precision
,
364 void * value_base
, int value_offset
) {
365 void * value
= openscop_int_address(precision
, value_base
, value_offset
);
368 case OPENSCOP_PRECISION_SP
:
369 sprintf(string
, OPENSCOP_FMT_SP
, *(long int *)value
);
372 case OPENSCOP_PRECISION_DP
:
373 sprintf(string
, OPENSCOP_FMT_DP
, *(long long int *)value
);
376 #ifdef OPENSCOP_GMP_IS_HERE
377 case OPENSCOP_PRECISION_MP
: {
379 str
= mpz_get_str(0, 10, *(mpz_t
*)value
); //TODO: 10 -> #define
380 sprintf(string
, OPENSCOP_FMT_MP
, str
);
387 OPENSCOP_error("unknown precision");
392 void openscop_int_sread(char * string
, int precision
,
393 void * value_base
, int value_offset
) {
394 void * value
= openscop_int_address(precision
, value_base
, value_offset
);
398 case OPENSCOP_PRECISION_SP
:
399 nb_read
= sscanf(string
, OPENSCOP_FMT_TXT_SP
, (long int *)value
);
401 OPENSCOP_error("failed to read an integer");
404 case OPENSCOP_PRECISION_DP
:
405 nb_read
= sscanf(string
, OPENSCOP_FMT_TXT_DP
, (long long int *)value
);
407 OPENSCOP_error("failed to read an integer");
410 #ifdef OPENSCOP_GMP_IS_HERE
411 case OPENSCOP_PRECISION_MP
: {
413 nb_read
= sscanf(string
, OPENSCOP_FMT_TXT_DP
, &tmp
);
415 OPENSCOP_error("failed to read an integer");
416 mpz_set_si(*(mpz_t
*)value
, tmp
);
422 OPENSCOP_error("unknown precision");
427 /*+***************************************************************************
428 * Arithmetic Operations *
429 *****************************************************************************/
432 void openscop_int_increment(int precision
,
433 void * result_base
, int result_offset
,
434 void * value_base
, int value_offset
) {
435 void * result
= openscop_int_address(precision
, result_base
, result_offset
);
436 void * value
= openscop_int_address(precision
, value_base
, value_offset
);
439 case OPENSCOP_PRECISION_SP
:
440 *(long int *)result
= *(long int *)value
+ (long int)1;
443 case OPENSCOP_PRECISION_DP
:
444 *(long long int *)result
= *(long long int *)value
+ (long long int)1;
447 #ifdef OPENSCOP_GMP_IS_HERE
448 case OPENSCOP_PRECISION_MP
:
449 mpz_add_ui(*(mpz_t
*)result
, *(mpz_t
*)value
, 1);
454 OPENSCOP_error("unknown precision");
459 void openscop_int_add(int precision
,
460 void * result_base
, int result_offset
,
461 void * val1_base
, int val1_offset
,
462 void * val2_base
, int val2_offset
) {
463 void * result
= openscop_int_address(precision
, result_base
, result_offset
);
464 void * val1
= openscop_int_address(precision
, val1_base
, val1_offset
);
465 void * val2
= openscop_int_address(precision
, val2_base
, val2_offset
);
468 case OPENSCOP_PRECISION_SP
:
469 *(long int *)result
= *(long int *)val1
+ *(long int *)val2
;
472 case OPENSCOP_PRECISION_DP
:
473 *(long long int *)result
= *(long long int *)val1
+
474 *(long long int *)val2
;
477 #ifdef OPENSCOP_GMP_IS_HERE
478 case OPENSCOP_PRECISION_MP
:
479 mpz_add(*(mpz_t
*)result
, *(mpz_t
*)val1
, *(mpz_t
*)val2
);
484 OPENSCOP_error("unknown precision");
489 void openscop_int_add_ui(int precision
,
490 void * result_base
, int result_offset
,
491 void * value_base
, int value_offset
, int i
) {
492 void * result
= openscop_int_address(precision
, result_base
, result_offset
);
493 void * value
= openscop_int_address(precision
, value_base
, value_offset
);
496 case OPENSCOP_PRECISION_SP
:
497 *(long int *)result
= *(long int *)value
+ (long int)i
;
500 case OPENSCOP_PRECISION_DP
:
501 *(long long int *)result
= *(long long int *)value
+ (long long int)i
;
504 #ifdef OPENSCOP_GMP_IS_HERE
505 case OPENSCOP_PRECISION_MP
:
506 mpz_add_ui(*(mpz_t
*)result
, *(mpz_t
*)value
, (long int)i
);
511 OPENSCOP_error("unknown precision");
516 void openscop_int_mul(int precision
,
517 void * result_base
, int result_offset
,
518 void * val1_base
, int val1_offset
,
519 void * val2_base
, int val2_offset
) {
520 void * result
= openscop_int_address(precision
, result_base
, result_offset
);
521 void * val1
= openscop_int_address(precision
, val1_base
, val1_offset
);
522 void * val2
= openscop_int_address(precision
, val2_base
, val2_offset
);
525 case OPENSCOP_PRECISION_SP
:
526 *(long int *)result
= *(long int *)val1
* *(long int *)val2
;
529 case OPENSCOP_PRECISION_DP
:
530 *(long long int *)result
= *(long long int *)val1
*
531 *(long long int *)val2
;
534 #ifdef OPENSCOP_GMP_IS_HERE
535 case OPENSCOP_PRECISION_MP
:
536 mpz_mul(*(mpz_t
*)result
, *(mpz_t
*)val1
, *(mpz_t
*)val2
);
541 OPENSCOP_error("unknown precision");
546 void openscop_int_mul_si(int precision
,
547 void * result_base
, int result_offset
,
548 void * value_base
, int value_offset
, int i
) {
549 void * result
= openscop_int_address(precision
, result_base
, result_offset
);
550 void * value
= openscop_int_address(precision
, value_base
, value_offset
);
553 case OPENSCOP_PRECISION_SP
:
554 *(long int *)result
= *(long int *)value
* (long int)i
;
557 case OPENSCOP_PRECISION_DP
:
558 *(long long int *)result
= *(long long int *)value
* (long long int)i
;
561 #ifdef OPENSCOP_GMP_IS_HERE
562 case OPENSCOP_PRECISION_MP
:
563 mpz_mul_si(*(mpz_t
*)result
, *(mpz_t
*)value
, i
);
568 OPENSCOP_error("unknown precision");
573 void openscop_int_sub(int precision
,
574 void * result_base
, int result_offset
,
575 void * val1_base
, int val1_offset
,
576 void * val2_base
, int val2_offset
) {
577 void * result
= openscop_int_address(precision
, result_base
, result_offset
);
578 void * val1
= openscop_int_address(precision
, val1_base
, val1_offset
);
579 void * val2
= openscop_int_address(precision
, val2_base
, val2_offset
);
582 case OPENSCOP_PRECISION_SP
:
583 *(long int *)result
= *(long int *)val1
- *(long int *)val2
;
586 case OPENSCOP_PRECISION_DP
:
587 *(long long int *)result
= *(long long int *)val1
-
588 *(long long int *)val2
;
591 #ifdef OPENSCOP_GMP_IS_HERE
592 case OPENSCOP_PRECISION_MP
:
593 mpz_sub(*(mpz_t
*)result
, *(mpz_t
*)val1
, *(mpz_t
*)val2
);
598 OPENSCOP_error("unknown precision");
603 void openscop_int_oppose(int precision
,
604 void * result_base
, int result_offset
,
605 void * value_base
, int value_offset
) {
606 void * result
= openscop_int_address(precision
, result_base
, result_offset
);
607 void * value
= openscop_int_address(precision
, value_base
, value_offset
);
610 case OPENSCOP_PRECISION_SP
:
611 *(long int *)result
= -*(long int *)value
;
614 case OPENSCOP_PRECISION_DP
:
615 *(long long int *)result
= -*(long long int *)value
;
618 #ifdef OPENSCOP_GMP_IS_HERE
619 case OPENSCOP_PRECISION_MP
:
620 mpz_neg(*(mpz_t
*)result
, *(mpz_t
*)value
);
625 OPENSCOP_error("unknown precision");
630 /*+***************************************************************************
631 * Conditional Operations *
632 *****************************************************************************/
635 int openscop_int_eq(int precision
,
636 void * val1_base
, int val1_offset
,
637 void * val2_base
, int val2_offset
) {
638 void * val1
= openscop_int_address(precision
, val1_base
, val1_offset
);
639 void * val2
= openscop_int_address(precision
, val2_base
, val2_offset
);
642 case OPENSCOP_PRECISION_SP
:
643 return (*(long int *)val1
== *(long int *)val2
);
645 case OPENSCOP_PRECISION_DP
:
646 return (*(long long int *)val1
== *(long long int *)val2
);
648 #ifdef OPENSCOP_GMP_IS_HERE
649 case OPENSCOP_PRECISION_MP
:
650 return (mpz_cmp(*(mpz_t
*)val1
, *(mpz_t
*)val2
) == 0);
654 OPENSCOP_error("unknown precision");
659 int openscop_int_ne(int precision
,
660 void * val1_base
, int val1_offset
,
661 void * val2_base
, int val2_offset
) {
662 void * val1
= openscop_int_address(precision
, val1_base
, val1_offset
);
663 void * val2
= openscop_int_address(precision
, val2_base
, val2_offset
);
666 case OPENSCOP_PRECISION_SP
:
667 return (*(long int *)val1
!= *(long int *)val2
);
669 case OPENSCOP_PRECISION_DP
:
670 return (*(long long int *)val1
!= *(long long int *)val2
);
672 #ifdef OPENSCOP_GMP_IS_HERE
673 case OPENSCOP_PRECISION_MP
:
674 return (mpz_cmp(*(mpz_t
*)val1
, *(mpz_t
*)val2
) != 0);
678 OPENSCOP_error("unknown precision");
683 int openscop_int_pos(int precision
, void * value_base
, int value_offset
) {
684 void * value
= openscop_int_address(precision
, value_base
, value_offset
);
687 case OPENSCOP_PRECISION_SP
:
688 return (*(long int *)value
> 0);
690 case OPENSCOP_PRECISION_DP
:
691 return (*(long long int *)value
> 0);
693 #ifdef OPENSCOP_GMP_IS_HERE
694 case OPENSCOP_PRECISION_MP
:
695 return (mpz_sgn(*(mpz_t
*)value
) > 0);
699 OPENSCOP_error("unknown precision");
704 int openscop_int_neg(int precision
, void * value_base
, int value_offset
) {
705 void * value
= openscop_int_address(precision
, value_base
, value_offset
);
708 case OPENSCOP_PRECISION_SP
:
709 return (*(long int *)value
< 0);
711 case OPENSCOP_PRECISION_DP
:
712 return (*(long long int *)value
< 0);
714 #ifdef OPENSCOP_GMP_IS_HERE
715 case OPENSCOP_PRECISION_MP
:
716 return (mpz_sgn(*(mpz_t
*)value
) < 0);
720 OPENSCOP_error("unknown precision");
725 int openscop_int_zero(int precision
, void * value_base
, int value_offset
) {
726 void * value
= openscop_int_address(precision
, value_base
, value_offset
);
729 case OPENSCOP_PRECISION_SP
:
730 return (*(long int *)value
== 0);
732 case OPENSCOP_PRECISION_DP
:
733 return (*(long long int *)value
== 0);
735 #ifdef OPENSCOP_GMP_IS_HERE
736 case OPENSCOP_PRECISION_MP
:
737 return (mpz_sgn(*(mpz_t
*)value
) == 0);
741 OPENSCOP_error("unknown precision");
746 int openscop_int_notzero(int precision
, void * value_base
, int value_offset
) {
747 void * value
= openscop_int_address(precision
, value_base
, value_offset
);
750 case OPENSCOP_PRECISION_SP
:
751 return (*(long int *)value
!= 0);
753 case OPENSCOP_PRECISION_DP
:
754 return (*(long long int *)value
!= 0);
756 #ifdef OPENSCOP_GMP_IS_HERE
757 case OPENSCOP_PRECISION_MP
:
758 return (mpz_sgn(*(mpz_t
*)value
) != 0);
762 OPENSCOP_error("unknown precision");
767 int openscop_int_one(int precision
, void * value_base
, int value_offset
) {
768 void * value
= openscop_int_address(precision
, value_base
, value_offset
);
771 case OPENSCOP_PRECISION_SP
:
772 return (*(long int *)value
== (long int)1);
774 case OPENSCOP_PRECISION_DP
:
775 return (*(long long int *)value
== (long long int)1);
777 #ifdef OPENSCOP_GMP_IS_HERE
778 case OPENSCOP_PRECISION_MP
:
779 return (mpz_cmp_si(*(mpz_t
*)value
, 1) == 0);
783 OPENSCOP_error("unknown precision");
788 int openscop_int_mone(int precision
, void * value_base
, int value_offset
) {
789 void * value
= openscop_int_address(precision
, value_base
, value_offset
);
792 case OPENSCOP_PRECISION_SP
:
793 return (*(long int *)value
== (long int)-1);
795 case OPENSCOP_PRECISION_DP
:
796 return (*(long long int *)value
== (long long int)-1);
798 #ifdef OPENSCOP_GMP_IS_HERE
799 case OPENSCOP_PRECISION_MP
:
800 return (mpz_cmp_si(*(mpz_t
*)value
, -1) == 0);
804 OPENSCOP_error("unknown precision");
809 int openscop_int_divisible(int precision
,
810 void * val1_base
, int val1_offset
,
811 void * val2_base
, int val2_offset
) {
812 void * val1
= openscop_int_address(precision
, val1_base
, val1_offset
);
813 void * val2
= openscop_int_address(precision
, val2_base
, val2_offset
);
816 case OPENSCOP_PRECISION_SP
:
817 return ((*(long int *)val1
% *(long int *)val2
) == 0);
819 case OPENSCOP_PRECISION_DP
:
820 return ((*(long long int *)val1
% *(long long int *)val2
) == 0);
822 #ifdef OPENSCOP_GMP_IS_HERE
823 case OPENSCOP_PRECISION_MP
:
824 return mpz_divisible_p(*(mpz_t
*)val1
, *(mpz_t
*)val2
);
828 OPENSCOP_error("unknown precision");