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
/* | |
* 5.2 Uniform real distribution ----------------------------------------------- | |
* | |
* Generating uniform random floating-point numbers might seem easy at first | |
* glance, just cast the output of a PRNG to the desired float type and divide | |
* by the biggest possible output of the PRNG to obtain a random float between | |
* 0 and 1 that can now be scaled up. | |
* Though as before this straightforward approach is biased. | |
* | |
* For the next part, I assume you are already acquainted with the IEEE 754 |
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
struct list { struct list *list; }; | |
struct list * | |
list(struct list *list) | |
{ | |
list: | |
if (list->list && (list = list->list)) | |
goto list; | |
return list; | |
} |
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
i,j,k,L; | |
#include <time.h> | |
float X,Y,Z,l,t,x,y,z, | |
A,S,C;r(X,Y)float*X,*Y;{A | |
=*X,S=sin(l),C=cos(l);*X=A*C | |
-*Y*S,*Y=A*S+*Y *C;}main() | |
{char*p,s[L=( W+1)*H]; | |
printf("\x1b" "[2J");r | |
:p=s;for(i=0; i<H;++i, | |
*p++=10)for(j =0;j<W; |
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> | |
#define E2(...) E1(E1(E1(E1(E1(E1(E1(E1(E1(E1(__VA_ARGS__)))))))))) | |
#define E1(...) __VA_ARGS__ | |
#define EMPTY() | |
#define DEFER1(m) m EMPTY() | |
#define APPLY3(F,a,x,y,v) F(a,0,x,y,v), F(a,1,x,y,v), F(a,2,x,y,v), \ | |
F(a,3,x,y,v), F(a,4,x,y,v), F(a,5,x,y,v), \ | |
F(a,6,x,y,v), F(a,7,x,y,v), F(a,8,x,y,v), \ |
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> | |
#define E2(...) E1(E1(E1(E1(E1(E1(E1(E1(E1(E1(__VA_ARGS__)))))))))) | |
#define E1(...) __VA_ARGS__ | |
#define EMPTY() | |
#define DEFER1(m) m EMPTY() | |
#define APPLY3(F,a,m,k) F(a,0,m,k), F(a,1,m,k), F(a,2,m,k), \ | |
F(a,3,m,k), F(a,4,m,k), F(a,5,m,k), \ | |
F(a,6,m,k), F(a,7,m,k), F(a,8,m,k), \ |
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 <time.h> | |
static const char mon_name[12][3] = { | |
"Jan", "Feb", "Mar", "Apr", "May", "Jun", | |
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" | |
}; | |
int | |
main(void) |
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
#define XXX_CM_UP_0(P,a,b,c,d,e,f,...) XXX_CM_PASS_UP_1 (XXX_CM_PASS_DN_0 (XXX__##f(,P##a,P##b,P##c,P##d,P##e,P##__VA_ARGS__))) | |
#define XXX_CM_UP_1(P,a,b,c,d,e,f,...) XXX_CM_PASS_UP_2 (XXX_CM_PASS_DN_1 (XXX__##f(,P##a,P##b,P##c,P##d,P##e,P##__VA_ARGS__))) | |
#define XXX_CM_UP_2(P,a,b,c,d,e,f,...) XXX_CM_PASS_UP_3 (XXX_CM_PASS_DN_2 (XXX__##f(,P##a,P##b,P##c,P##d,P##e,P##__VA_ARGS__))) | |
#define XXX_CM_UP_3(P,a,b,c,d,e,f,...) XXX_CM_PASS_UP_4 (XXX_CM_PASS_DN_3 (XXX__##f(,P##a,P##b,P##c,P##d,P##e,P##__VA_ARGS__))) | |
#define XXX_CM_UP_4(P,a,b,c,d,e,f,...) XXX_CM_PASS_UP_5 (XXX_CM_PASS_DN_4 (XXX__##f(,P##a,P##b,P##c,P##d,P##e,P##__VA_ARGS__))) | |
#define XXX_CM_UP_5(P,a,b,c,d,e,f,...) XXX_CM_PASS_UP_6 (XXX_CM_PASS_DN_5 (XXX__##f(,P##a,P##b,P##c,P##d,P##e,P##__VA_ARGS__))) | |
#define XXX_CM_UP_6(P,a,b,c,d,e,f,...) XXX_CM_PASS_UP_7 (XXX_CM_PASS_DN_6 (XXX__##f(,P##a,P##b,P##c,P##d,P##e,P##__VA_ARGS__))) | |
#define XXX_CM_UP_7(P,a,b,c,d,e,f,...) XXX_CM_PASS_UP_8 (XXX_CM_PASS_DN_7 (XXX__##f(,P##a,P##b,P##c,P##d,P##e,P##__VA_AR |
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 <stdint.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <limits.h> | |
#ifdef _OPENMP | |
#include <omp.h> | |
#endif | |
/* | |
* macchanger --random uses the following code to generate random MAC addresses: |
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
# rvv-rollback.S -- A minimal benchmarking library | |
# Olaf Bernstein <[email protected]> | |
# Distributed under the MIT license, see license at the end of the file. | |
# New versions available at https://gist.github.com/camel-cdr/cfd9ba2b8754b521edf4892fe19c7031 | |
# Conversions taken from https://github.com/RISCVtestbed/rvv-rollback | |
.macro vle32.v a:vararg | |
vlw.v \a | |
.endm | |
.macro vle16.v a:vararg |
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
.global shishua_rvv # void shishua_rvv (uint64_t state[4], void *dest, size_t n) | |
shishua_rvv: | |
# load state (can easily be expanded to state[8] or state[16]) | |
vsetvli t6, x0, e64, m2, ta, ma | |
ld a4, 0(a0) | |
vmv.v.x v0, a4 | |
ld a4, 8(a0) | |
vmv.v.x v4, a4 | |
ld a4, 16(a0) | |
vmv.v.x v8, a4 |
OlderNewer