This file contains 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 <string.h> | |
#include <unistd.h> | |
#include <ctype.h> | |
#include <termios.h> | |
int main(void) | |
{ | |
char buf[BUFSIZ]; |
This file contains 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> | |
int main(int argc, char *argv[]) | |
{ | |
int i; | |
for(i=0;i<argc;i++) { | |
printf("Argument %d: %s\n", i, argv[i]); | |
} | |
} |
This file contains 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
given that: | |
f(2n) = n/2 | |
f(2n+1) = 3n+1 | |
we can see that the pattern translates to a pattern of 4x+(0,1,2,3) such that: | |
(4x+0)/2 = 2n (potentially 4x+2 or 4x+0) | |
(4x+1) = 2n+1 | |
(4x+2)/2 = 2n+1 | |
(4x+3) = 2n+1 |
This file contains 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
diff -pruN a/include/errno.h b/include/errno.h | |
--- include/errno.h 2012-05-15 07:20:09.000000000 +0000 | |
+++ include/errno.h 2014-08-28 10:08:31.046932387 +0000 | |
@@ -87,7 +87,7 @@ extern __thread int errno attribute_tls_ | |
might need this definition sometimes even if this file was included | |
before. */ | |
#if defined __USE_GNU || defined __need_error_t | |
-# ifndef __error_t_defined | |
+# if !defined __error_t_defined && !defined error_t | |
typedef int error_t; |
This file contains 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 <string.h> | |
#include <time.h> | |
#define LIST_SIZE 1024 * 1024 * 25 | |
/* min by compare */ | |
inline int mbc(int a, int b) { return a > b? b: a; } |
This file contains 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 node_s * add_node(struct node_s ** tree, struct node_s * leaf) | |
{ | |
if(*tree == NULL) | |
*tree = leaf; | |
else if((*tree)->key > leaf->key) { | |
leaf->right = *tree; | |
*tree = leaf; | |
} | |
else if((*tree)->key < leaf->key) { | |
leaf->left = *tree; |
This file contains 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
.file "mynewx.c" | |
.section .rodata.str1.1,"aMS",@progbits,1 | |
.LC0: | |
.string "numbers.txt" | |
.LC1: | |
.string "%u\n" | |
.LC2: | |
.string "%d in %ld ms\n" | |
.section .text.startup,"ax",@progbits | |
.p2align 4,,15 |
This file contains 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 <string.h> | |
void swap(int *p, int i, int j) | |
{ | |
int t = p[i]; | |
p[i] = p[j]; | |
p[j] = t; | |
} |
This file contains 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 <string.h> | |
#include <unistd.h> | |
#include <time.h> | |
#include <fcntl.h> | |
#include <sys/stat.h> | |
#define PATH "numbers.txt" | |
#define CHUNK_SIZE 4096 |
This file contains 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> | |
#include <omp.h> | |
int main() | |
{ | |
unsigned long long l = 0, a = 0; | |
clock_t start, stop; | |
start = clock(); |
NewerOlder