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 <fcntl.h> | |
#include <unistd.h> | |
#include <stdbool.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/stat.h> | |
int main() |
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 <stdbool.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define ROOM_A_ENTRANCE 2 | |
#define ROOM_B_ENTRANCE 4 | |
#define ROOM_C_ENTRANCE 6 | |
#define ROOM_D_ENTRANCE 8 |
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 <time.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#define MILLION 1000000 | |
#define BILLION 1000000000 | |
int main(void) | |
{ | |
struct timespec start, end; |
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 <fcntl.h> | |
#include <unistd.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <sys/stat.h> | |
int main(void) | |
{ | |
// Using POSIX open/read functions | |
// If using Windows, you probably want to use fopen/fread (or native Windows API) |
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
#define CHECKMATE_EVALUATION -9001 | |
#define STALEMATE_EVALUATION 0 | |
static int AISearch(int depth, GameState *state, int alpha, int beta) | |
{ | |
if (depth == 0) | |
{ | |
return AIEvaluate(state); | |
} | |
uint16_t moves[1024]; |
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 --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c | |
index 071fd093a5f4..a4ba824395b0 100644 | |
--- a/drivers/hid/hid-microsoft.c | |
+++ b/drivers/hid/hid-microsoft.c | |
@@ -27,6 +27,7 @@ | |
#define MS_DUPLICATE_USAGES BIT(5) | |
#define MS_SURFACE_DIAL BIT(6) | |
#define MS_QUIRK_FF BIT(7) | |
+#define MS_QUIRK_XBOX BIT(8) | |
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 <errno.h> | |
#include <fcntl.h> | |
#include <stdbool.h> | |
#include <stdint.h> | |
#include <string.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
struct rng { | |
uint64_t state; |
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
void swap_xor(int *x, int *y) | |
{ | |
*x = *x ^ *y; | |
*y = *x ^ *y; | |
*x = *x ^ *y; | |
} | |
void swap_normal(int *x, int *y) | |
{ | |
int temp = *x; |
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 <stdint.h> | |
#include <time.h> | |
#define ARRAY_SIZE 1000000 | |
int compare(const void *a, const void *b) | |
{ | |
int ia = *(int*)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
from time import perf_counter_ns | |
array_size = 1000000 | |
array = [] | |
with open("unsorted.txt") as unsorted: | |
for i in range(array_size): | |
array.append(int(unsorted.readline())) | |
start = perf_counter_ns() |