This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <limits.h> | |
#include <stdint.h> | |
/* Number of bits in inttype_MAX, or in any (1<<k)-1 where 0 <= k < 2040 */ | |
/* (Attributed to Hallvard B. Furuseth.) */ | |
#define IMAX_BITS(m) ((m)/((m)%255+1) / 255%255*8 + 7-86/((m)%255+12)) | |
/* Helper macros. */ | |
#define MY___WIDTH(x) IMAX_BITS(x##_MAX) | |
#define MY__U__WIDTH(x) MY___WIDTH(U##x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stddef.h> | |
#include "heapsort.h" | |
#include "swapmem.h" | |
typedef int (*fnp_compar_arg)(const void *, const void *, void *); | |
typedef int (*fnp_compar)(const void *, const void *); | |
static void heapify(unsigned char *base, size_t nmemb, size_t size, size_t root, | |
fnp_compar_arg compar, void *arg, int hasarg) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
#include <limits.h> | |
/** | |
* \brief Returns Greatest Common Divisor of two unsigned long long values. | |
* | |
* \param[in] a First value. | |
* \param[in] b Second value. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <gmpxx.h> | |
static mpz_class falling_fac(unsigned long n, unsigned long k) | |
{ | |
mpz_class result = 1; | |
if (k > n) { | |
k = n; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <windows.h> | |
/* | |
* This is an alternative to the RtlNtStatusToDosError() | |
* function in ntdll.dll. It uses the GetOverlappedResult() | |
* function in kernel32.dll to do the conversion. | |
*/ | |
DWORD | |
ConvertNtStatusToWin32Error(LONG ntstatus) | |
{ |