pouët.net

Random line of code thread

category: code [glöplog]
while ($drow = $stmt->fetch(PDO::FETCH_ASSOC)) {
if ($drow["title"]) {
$musicURL = ReturnMusicURL($drow["Path"]);
$lengthinseconds = ($drow["CueOut"] - $drow["CueIn"]);
$response .= "{\"ID\":" . $drow["id"] . ",";
$response .= "\"StationID\":" . $StationID . ",";
$response .= "\"StationName\":\"" . $StationName . "\",";
$response .= "\"Title\":\"" . superentities($drow["title"]) . "\",";
$response .= "\"Fullartist\":\"" . superentities($drow["fullartist"]) . "\",";
$response .= "\"Album\":\"" . superentities($drow["Album"]) . "\",";
$response .= "\"Image\":\"" . ReturnImageType($drow["Album"]) . "\",";

(...)
added on the 2026-06-21 00:07:20 by stripecat stripecat
random wav lib i made for a os
Code:#include "wav.h" #include "../string.h" // for memcmp, memcpy static uint32_t rd32(const uint8_t* p) { return (uint32_t)p[0] | ((uint32_t)p[1] << 8) | ((uint32_t)p[2] << 16) | ((uint32_t)p[3] << 24); } static uint16_t rd16(const uint8_t* p) { return (uint16_t)p[0] | ((uint16_t)p[1] << 8); } int wav_parse(wav_t* out, const uint8_t* buf, size_t size) { if (size < 44) return 0; // RIFF + WAVE if (memcmp(buf, "RIFF", 4) != 0) return 0; if (memcmp(buf + 8, "WAVE", 4) != 0) return 0; size_t pos = 12; while (pos + 8 <= size) { const uint8_t* chunk = buf + pos; uint32_t chunk_size = rd32(chunk + 4); if (memcmp(chunk, "fmt ", 4) == 0) { out->audio_format = rd16(chunk + 8); out->channels = rd16(chunk + 10); out->sample_rate = rd32(chunk + 12); out->byte_rate = rd32(chunk + 16); out->block_align = rd16(chunk + 20); out->bits_per_sample= rd16(chunk + 22); } if (memcmp(chunk, "data", 4) == 0) { out->data = chunk + 8; out->data_size = chunk_size; return 1; // success } pos += 8 + chunk_size; } return 0; }
added on the 2026-06-21 03:16:52 by hlder hlder
im so programmer
Code:const wtf = Math.floor(Math.random() * idk.length); document.getElementById("funni").innerHTML = idk[wtf];
added on the 2026-06-21 23:53:41 by juanp32 juanp32
LDA #$01
STA $D020
added on the 2026-06-25 11:53:16 by J-san J-san
Code:move.w #TIMEOUT*54,$05e(a6)
added on the 2026-06-27 19:29:14 by Blueberry Blueberry
buf1 = buf1 (+(-buf1 * cut)) + buf1);
buf2 = buf2 (+(-buf2 * (cut / 1.3))) + buf2);
buf3 = buf3 (+(-buf3 * ((cut / 1.3))/1.3)) + buf3);

Got Dam. Is this a "samplerateless" constant-q filter you think? (9db Phase, 18dB filler, via impulseresponse alignment)
added on the 2026-06-27 20:34:25 by J-san J-san
dont ask
Code:printf("aaaaaaaaaaaaaaaaaaa");
added on the 2026-06-30 19:03:20 by juanp32 juanp32
AVX ;-)
added on the 2026-07-04 22:42:49 by J-san J-san
printf("And I wrote right the wrong way")
added on the 2026-07-05 10:58:20 by Optimus Optimus
Code:EvalGeometry(geo, worldpos, query.CommittedRayT(), barycentrics, query.CommittedInstanceID(), query.CommittedPrimitiveIndex(), objToWorld);
Someone is using DXR RayQuery, it seems.
added on the 2026-07-05 16:22:17 by fizzer fizzer
BB Image
added on the 2026-07-06 09:34:22 by J-san J-san
idk

Code:static inline void NoCRT_memcpy(void* dst, const void* src, size_t num) { if (num == 0) return; NoCRT_init_cpu_features(); // for lil blocks (16byte) SSE // modern cpu's will likely turn this switch into some optimized shit if (num < 16) { unsigned char* d = (unsigned char*)dst; const unsigned char* s = (const unsigned char*)src; switch (num) { case 1: *d = *s; return; case 2: *(uint16_t*)d = *(const uint16_t*)s; return; // /Ob2 compiler optimizes safe-cast case 4: *(uint32_t*)d = *(const uint32_t*)s; return; case 8: *(uint64_t*)d = *(const uint64_t*)s; return; default: break; } // for non aligned of what remains (3, 5, 6, 7, 9-15) __movsb will be faster // so the sheesh above can be cooler __movsb(d, s, num); return; } // vector sheesh for big bad blocks // NOTICE: for AVX-512 blocks needed are from 128 to 256byte // or cpu can throttle a little bit (AVX throttling) if (NoCRT_cpu_avx512 && num >= 128) { size_t n64 = num >> 6; __m512i* d = (__m512i*)dst; const __m512i* s = (const __m512i*)src; for (size_t i = 0; i < n64; i++) { _mm512_storeu_si512(d + i, _mm512_loadu_si512(s + i)); } num &= 63; // remainig tail if (num == 0) return; dst = (void*)(d + n64); src = (const void*)(s + n64); //_mm512_stream_si512((__m512i*)(d + i), _mm512_loadu_si512(s + i)); } if (NoCRT_cpu_avx2 && num >= 32) { size_t n32 = num >> 5; __m256i* d = (__m256i*)dst; const __m256i* s = (const __m256i*)src; for (size_t i = 0; i < n32; i++) { _mm256_storeu_si256(d + i, _mm256_loadu_si256(s + i)); } num &= 31; if (num == 0) return; dst = (void*)(d + n32); src = (const void*)(s + n32); //_mm256_stream_si256((__m256i*)(d + i), _mm256_loadu_si256(s + i)); } if (NoCRT_cpu_sse2 && num >= 16) { size_t n16 = num >> 4; __m128i* d = (__m128i*)dst; const __m128i* s = (const __m128i*)src; for (size_t i = 0; i < n16; i++) { _mm_storeu_si128(d + i, _mm_loadu_si128(s + i)); } num &= 15; if (num == 0) return; dst = (void*)(d + n16); src = (const void*)(s + n16); //_mm_stream_si128((__m128i*)(d + i), _mm_loadu_si128(s + i)); } // tail (remainings), or just old cpus // if size > 64byte (on old CPUs), ERMS will turn on and it makes it faster // if this lil tail after AVX/SSE, __movsb will work great __movsb((unsigned char*)dst, (const unsigned char*)src, num); }
added on the 2026-07-06 18:26:42 by dadatel dadatel

login