Software: Apache. PHP/5.4.45 

uname -a: Linux webm056.cluster010.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue
Sep 17 08:14:20 UTC 2024 x86_64
 

uid=243112(mycochar) gid=100(users) groups=100(users)  

Safe-mode: OFF (not secure)

/home/mycochar/www/image/photo/gcc-12.3.0/gmp-6.2.1/tests/mpz/   drwxr-xr-x
Free 0 B of 0 B (0%)
Your ip: 216.73.216.77 - Server ip: 213.186.33.19
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    

[Enumerate]    [Encoder]    [Tools]    [Proc.]    [FTP Brute]    [Sec.]    [SQL]    [PHP-Code]    [Backdoor Host]    [Back-Connection]    [milw0rm it!]    [PHP-Proxy]    [Self remove]
    


Viewing file:     t-fits.c (4.91 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
/* Test mpz_fits_*_p */

/*
Copyright 2001 Free Software Foundation, Inc.

This file is part of the GNU MP Library test suite.

The GNU MP Library test suite is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 3 of the License,
or (at your option) any later version.

The GNU MP Library test suite is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
Public License for more details.

You should have received a copy of the GNU General Public License along with
the GNU MP Library test suite.  If not, see https://www.gnu.org/licenses/.  */

#include <stdio.h>
#include <stdlib.h>
#include "gmp-impl.h"
#include "tests.h"


/* Nothing sophisticated here, just exercise mpz_fits_*_p on a small amount
   of data. */

#define EXPECT_S(fun,name,answer)                                       \
  got = fun (z);                                                        \
  if (got != answer)                                                    \
    {                                                                   \
      printf ("%s (%s) got %d want %d\n", name, expr, got, answer);     \
      printf (" z size %d\n", SIZ(z));                                  \
      printf (" z dec "); mpz_out_str (stdout, 10, z); printf ("\n");   \
      printf (" z hex "); mpz_out_str (stdout, 16, z); printf ("\n");   \
      error = 1;                                                        \
    }

#define EXPECT(fun,answer)  EXPECT_S(fun,#fun,answer)

int
main (void)
{
  mpz_t       z;
  int         got;
  const char  *expr;
  int         error = 0;

  tests_start ();
  mpz_init (z);

  mpz_set_ui (z, 0L);
  expr = "0";
  EXPECT (mpz_fits_ulong_p, 1);
  EXPECT (mpz_fits_uint_p, 1);
  EXPECT (mpz_fits_ushort_p, 1);
  EXPECT (mpz_fits_slong_p, 1);
  EXPECT (mpz_fits_sint_p, 1);
  EXPECT (mpz_fits_sshort_p, 1);

  mpz_set_ui (z, 1L);
  expr = "1";
  EXPECT (mpz_fits_ulong_p, 1);
  EXPECT (mpz_fits_uint_p, 1);
  EXPECT (mpz_fits_ushort_p, 1);
  EXPECT (mpz_fits_slong_p, 1);
  EXPECT (mpz_fits_sint_p, 1);
  EXPECT (mpz_fits_sshort_p, 1);

  mpz_set_si (z, -1L);
  expr = "-1";
  EXPECT (mpz_fits_ulong_p, 0);
  EXPECT (mpz_fits_uint_p, 0);
  EXPECT (mpz_fits_ushort_p, 0);
  EXPECT (mpz_fits_slong_p, 1);
  EXPECT (mpz_fits_sint_p, 1);
  EXPECT (mpz_fits_sshort_p, 1);

  mpz_set_ui (z, 1L);
  mpz_mul_2exp (z, z, 5L*GMP_LIMB_BITS);
  expr = "2^(5*BPML)";
  EXPECT (mpz_fits_ulong_p, 0);
  EXPECT (mpz_fits_uint_p, 0);
  EXPECT (mpz_fits_ushort_p, 0);
  EXPECT (mpz_fits_slong_p, 0);
  EXPECT (mpz_fits_sint_p, 0);
  EXPECT (mpz_fits_sshort_p, 0);


  mpz_set_ui (z, (unsigned long) USHRT_MAX);
  expr = "USHRT_MAX";
  EXPECT (mpz_fits_ulong_p, 1);
  EXPECT (mpz_fits_uint_p, 1);
  EXPECT (mpz_fits_ushort_p, 1);

  mpz_set_ui (z, (unsigned long) USHRT_MAX);
  mpz_add_ui (z, z, 1L);
  expr = "USHRT_MAX + 1";
  EXPECT (mpz_fits_ushort_p, 0);


  mpz_set_ui (z, (unsigned long) UINT_MAX);
  expr = "UINT_MAX";
  EXPECT (mpz_fits_ulong_p, 1);
  EXPECT (mpz_fits_uint_p, 1);

  mpz_set_ui (z, (unsigned long) UINT_MAX);
  mpz_add_ui (z, z, 1L);
  expr = "UINT_MAX + 1";
  EXPECT (mpz_fits_uint_p, 0);


  mpz_set_ui (z, ULONG_MAX);
  expr = "ULONG_MAX";
  EXPECT (mpz_fits_ulong_p, 1);

  mpz_set_ui (z, ULONG_MAX);
  mpz_add_ui (z, z, 1L);
  expr = "ULONG_MAX + 1";
  EXPECT (mpz_fits_ulong_p, 0);


  mpz_set_si (z, (long) SHRT_MAX);
  expr = "SHRT_MAX";
  EXPECT (mpz_fits_slong_p, 1);
  EXPECT (mpz_fits_sint_p, 1);
  EXPECT (mpz_fits_sshort_p, 1);

  mpz_set_si (z, (long) SHRT_MAX);
  mpz_add_ui (z, z, 1L);
  expr = "SHRT_MAX + 1";
  EXPECT (mpz_fits_sshort_p, 0);


  mpz_set_si (z, (long) INT_MAX);
  expr = "INT_MAX";
  EXPECT (mpz_fits_slong_p, 1);
  EXPECT (mpz_fits_sint_p, 1);

  mpz_set_si (z, (long) INT_MAX);
  mpz_add_ui (z, z, 1L);
  expr = "INT_MAX + 1";
  EXPECT (mpz_fits_sint_p, 0);


  mpz_set_si (z, LONG_MAX);
  expr = "LONG_MAX";
  EXPECT (mpz_fits_slong_p, 1);

  mpz_set_si (z, LONG_MAX);
  mpz_add_ui (z, z, 1L);
  expr = "LONG_MAX + 1";
  EXPECT (mpz_fits_slong_p, 0);


  mpz_set_si (z, (long) SHRT_MIN);
  expr = "SHRT_MIN";
  EXPECT (mpz_fits_slong_p, 1);
  EXPECT (mpz_fits_sint_p, 1);
  EXPECT (mpz_fits_sshort_p, 1);

  mpz_set_si (z, (long) SHRT_MIN);
  mpz_sub_ui (z, z, 1L);
  expr = "SHRT_MIN + 1";
  EXPECT (mpz_fits_sshort_p, 0);


  mpz_set_si (z, (long) INT_MIN);
  expr = "INT_MIN";
  EXPECT (mpz_fits_slong_p, 1);
  EXPECT (mpz_fits_sint_p, 1);

  mpz_set_si (z, (long) INT_MIN);
  mpz_sub_ui (z, z, 1L);
  expr = "INT_MIN + 1";
  EXPECT (mpz_fits_sint_p, 0);


  mpz_set_si (z, LONG_MIN);
  expr = "LONG_MIN";
  EXPECT (mpz_fits_slong_p, 1);

  mpz_set_si (z, LONG_MIN);
  mpz_sub_ui (z, z, 1L);
  expr = "LONG_MIN + 1";
  EXPECT (mpz_fits_slong_p, 0);


  if (error)
    abort ();

  mpz_clear (z);
  tests_end ();
  exit (0);
}

Enter:
 
Select:
 

Useful Commands
 
Warning. Kernel may be alerted using higher levels
Kernel Info:

Php Safe-Mode Bypass (Read Files)

File:

eg: /etc/passwd

Php Safe-Mode Bypass (List Directories):

Dir:

eg: /etc/

Search
  - regexp 

Upload
 
[ ok ]

Make Dir
 
[ ok ]
Make File
 
[ ok ]

Go Dir
 
Go File
 

--[ x2300 Locus7Shell v. 1.0a beta Modded by #!physx^ | www.LOCUS7S.com | Generation time: 0.0062 ]--