Random line of code thread
category: code [glöplog]
Code:
pub fn tiles(&self) -> impl Iterator<Item = (usize, usize, &Tile)> {
let width = self.width;
self.tiles
.iter()
.enumerate()
.map(move |(i, tile)| (i % width, i / width, tile))
}
Code:
lea ecx, [ebp+__strempty-__self+EBP_bias] ; Elf32_Header.e_entry[0]
add bl, bl ; e_entry[1], e_entry[2]
db 0xEB ; e_entry[3]
... and 0xEB is the first half of a jmp
Code:
const char* iEmojiAtlas[]={
"🔴", "😡", "🤗", "🌕", "🎾", "🤢", "🌎", "🔵", "😈", "🍇",
"⚪", "🌕", "😡", "🍇", "😈", "🌑",
"🏿", "🏾", "🏽", "🏼", "🏻",
"🌑", "🌒", "🌓", "🌔", "🌕", "🌖", "🌗", "🌘",
"⚫", "🔘", "⚪",
" ", "💮", "⭕", "🔴",
" ", "🔸", "🌕",
"⬜",
"📕", "📙", "📒", "📗", "📘",
" ", " ", " ", " ", " ", " ", " ", " ",
"😈", "💖", "🌸",
"🍀", "🥦", "🎛", "🗑", "🌐", "🎽", "🔵", "🌞",
};
^^ This code is Art in itself! ^^
Code:
;$40=010 00 000 $58=0101 10 00
;$48=010 01 000 $59=0101 10 01
;$50=010 10 000 $5A=0101 10 10
;[draw attributes]
ld l,e
ld a,d
and %00011000
srl a
srl a
srl a
add a,$58
ld h,a
Code:
move.w #$51c8,4(a4) ; add fake dbf so our "search for end opcode" routine will work
Code:
mov dx,0f2fh
Code:
move.l (a7),a7 ; head hurts!
Code:
if (pause) {
btime = time - atime;
} else {
atime = time - btime;
}
Code:
bsamp_prepUVs(curX, curY, kMapAnd, kMapShift, U0, V0, U1, V1, fracU, fracV);
too complic!
just make it all global!
"static float curX, curY, kMapAnd, kMapShift, U0, V0, U1, V1, fracU, fracV;"
Oh, you do GLSL... :p
just make it all global!
"static float curX, curY, kMapAnd, kMapShift, U0, V0, U1, V1, fracU, fracV;"
Oh, you do GLSL... :p
it's an inline integer SSE function call
Code:
<svg onload=for(i=32640;i--;)write(i%255?i/128&i?'_':'#':'\n')>
spoiler (because pouet fucks this up)
Code:
bool doCompression = m_useTinyHeader || m_compressionType != COMPRESSION_INSTANT && !(reuseType == REUSE_STABLE && reuse != nullptr);
Code:
inline int IsVoid() const { return int(m_indexBits+m_wordIdx)>>31; } // Is 1 (sign bit) if zero children (0) and no word (-1).
.done:
// Stream samples from S-CPU
ldw {CPU0} // 5 left
stw 0 // 5
str {CPU3}=#$80 // 5 acknowledge
ldw {CPU2} // 5 right
str {CPU3}=#0 // 5 clear acknowledge
stw 2 // 5
ldw {CPU0} // 5 left
stw 0 // 5
str {CPU3}=#$80 // 5 acknowledge
ldw {CPU2} // 5 right
str {CPU3}=#0 // 5 clear acknowledge
stw 2 // 5
bra .done // 4
// Stream samples from S-CPU
ldw {CPU0} // 5 left
stw 0 // 5
str {CPU3}=#$80 // 5 acknowledge
ldw {CPU2} // 5 right
str {CPU3}=#0 // 5 clear acknowledge
stw 2 // 5
ldw {CPU0} // 5 left
stw 0 // 5
str {CPU3}=#$80 // 5 acknowledge
ldw {CPU2} // 5 right
str {CPU3}=#0 // 5 clear acknowledge
stw 2 // 5
bra .done // 4
Code:
const __m128i additive = c2vISSE(bsamp32(U, V, s_pEnvMap));
color = _mm_adds_epu16(color, additive);
// ckd//bevacqua -- old school 2x2 & 4x4 map interpolation blitters plus buffers to use (for heavier effects)
Code:
/*failed - normal colored sphere*/
float scenesdf(vec3 position)
{
return length(position)-60.0;
}
vec3 raydirection(float fov,vec2 pxposition,vec2 size)
{
float viewdistance = abs((size.y/2.0)/tan(radians(fov/2.0)));
vec3 raypredir = vec3 (pxposition-size/2.0,-viewdistance);
return normalize(raypredir);
}
float raydistance(int Mstep,float Mval,float error,vec3 direction,vec2 coord,vec3 eye)
{
vec3 predir;
predir = vec3(coord,0.0)+vec3(eye);
float returndepth;
for(int i = 0;i < Mstep;i++)
{
if(scenesdf(predir) < 0.0)
{
return Mval;
}
else
{
if(scenesdf(predir) < error)
{
return length(predir);
}
else
{
predir = scenesdf(predir) * direction + eye;
returndepth = length(predir);
}
}
if(returndepth > Mval)
{
returndepth = Mval;
return returndepth;
}
}
return returndepth;
}
vec3 normaldir(vec3 point,float error,float Mval)
{
vec3 returndir;
if(length(point) < Mval - error)
{
returndir =
vec3(
(scenesdf(vec3(point.x + error,point.y,point.z)) - scenesdf(vec3(point.x - error,point.y,point.z))),
(scenesdf(vec3(point.x,point.y + error,point.z)) - scenesdf(vec3(point.x,point.y - error,point.z))),
(scenesdf(vec3(point.x,point.y,point.z + error)) - scenesdf(vec3(point.x,point.y,point.z - error)))
);
}
else
{
return vec3(0.0,0.0,0.0);
}
return normalize(returndir);
}
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec3 eye = vec3(0.0,0.0,62.0);
vec3 raydir = raydirection(90.0,vec2(fragCoord),vec2(iResolution));
float depth = raydistance(256,1000.0,0.001,raydir,vec2(iResolution),vec3(eye));
vec3 norm = normaldir(vec3(raydir * depth),0.001,1000.0);
fragColor = vec4(norm,1.0);
}
Quote:
Random line of code thread
Quote:
line of code
Quote:
line
Code:
mov ah,12
Oh -
Sorry for too many lines..
Sorry for too many lines..
divu #61237,d0 ;)
Code:
jsr (d0.l)