!note https://old.reddit.com/r/C_Programming/comments/1kf7l7w/_/mqpavfa/
!profile openai
!:model gpt-4.1
!user
uint64_t dualmix128(uint64_t s[2])
{
uint64_t m = s[0] + s[1];
s[0] = m + (s[0]<<26 | s[0]>>38);
!note https://old.reddit.com/r/C_Programming/comments/1kf7l7w/_/mqpavfa/
!profile openai
!:model gpt-4.1
!user
uint64_t dualmix128(uint64_t s[2])
{
uint64_t m = s[0] + s[1];
s[0] = m + (s[0]<<26 | s[0]>>38);
!note https://old.reddit.com/r/C_Programming/comments/1kf7l7w/_/mqpavfa/
!profile openai
!:model o4-mini
!user
uint64_t dualmix128(uint64_t s[2])
{
uint64_t m = s[0] + s[1];
s[0] = m + (s[0]<<26 | s[0]>>38);
// Single consumer, single producer circular buffer using Win32 SRW | |
// Ref: https://github.com/vibhav950/cbuf | |
// Ref: https://old.reddit.com/r/C_Programming/comments/1jwnlrf | |
// Ref: https://nullprogram.com/blog/2024/10/03/ | |
#include <stddef.h> | |
#include <stdint.h> | |
#include <string.h> | |
typedef uint8_t u8; | |
typedef int32_t b32; |
!profile claude | |
!user | |
Please give me an example of using WASI `path_open` to open a file for writing. In particular, I don't know where to get the `dirfd` parameter. | |
!assistant | |
# Example of using WASI `path_open` to open a file for writing | |
The WASI `path_open` function requires a directory file descriptor (`dirfd`) as its first parameter because WASI uses a capability-based security model. Here's how to use it: |
// Robust Lock: if a "thread" exits while holding a lock, it is unlocked | |
// linux $ cc -pthread example.c | |
// w64dk $ cc example.c -lntdll | |
// Ref: https://old.reddit.com/r/C_Programming/comments/1jd82ux | |
// Ref: https://github.com/cozis/timestamp_lock | |
// This is free and unencumbered software released into the public domain. | |
#include <assert.h> | |
#include <stddef.h> | |
#include <stdint.h> | |
#include <stdio.h> |
// https://old.reddit.com/r/C_Programming/comments/1iljkn2 | |
// https://github.com/jamesnolanverran/dmap | |
#include "dmap.c" | |
#include <string.h> | |
#define KEYLEN 8 | |
#define RUNS 10 | |
#define KEYS 1000000 | |
static void encode(char *key, int x) |
// 1. Input: | |
// A number N, representing the size of the square board grid. N rows of | |
// N characters each, where each character is either R (red) or A (blue). | |
// | |
// 2. Objective: | |
// Rearrange the rows of the board to maximize the area of the largest | |
// contiguous rectangular zone for each color (R for The Famous, A for | |
// The Warriors). | |
// | |
// Determine the winning team based on the larger rectangular area of |
// Examples of quick hash tables and dynamic arrays in C | |
// https://nullprogram.com/blog/2025/01/19/ | |
// This is free and unencumbered software released into the public domain. | |
#include <assert.h> | |
#include <stdarg.h> | |
#include <stddef.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> |
Question 2: Steganography using 4-bit LSB algorithm | |
Scope: File Processing, Pointers, Dynamic Memory Allocation (No arrays) | |
File to use: stego_lsb.c | |
Preliminary: | |
This question should be solved using dynamic memory allocation along with | |
pointers. Any submitted work which includes an array will be given | |
automatically a zero mark. To view pgm files, you can use the “Irfan View” |
#include <assert.h> | |
#include <stddef.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define new(a, n, t) (t *)alloc(a, n, sizeof(t), _Alignof(t)) | |
#define S(s) (Str){(uint8_t *)s, sizeof(s)-1} |