Random line of code thread
category: code [glöplog]
wget -O - http://gcc.gnu.org/onlinedocs/gcc-3.3.6/cpp/Tokenization.html|grep -A3 "+++++"
Code:
/* en passant captures */
if(i+9*dir==epSquare[Ply]) {
Board[i+9*dir+120]=Board[i];
Board[i+(9-10)*dir+120]=ES;
NextDepth(9*dir,2)
Board[i+9*dir+120]=ES;
Board[i+(9-10)*dir+120]=Board[i+(9-10)*dir];
}
Code:
QString str = mList[i];
Code:
public int getkaartNRInt(){
return this.kaartNR;
}
Code:
if ( str.length() > 10 ) return false;
Generated code for drawing a sprite (1 out of 16 routines)
Code:
skull0: ANDI.L #$807F807F,(A0)
ORI.L #$5C806380,(A0)
ANDI.L #$3F003F,$A0(A0)
ORI.L #$BE40C1C0,$A0(A0)
ANDI.L #$1F001F,$140(A0)
ORI.L #$BE60C1E0,$140(A0)
ANDI.L #$1F001F,$1E0(A0)
ORI.L #$ECE0F3E0,$1E0(A0)
ANDI.L #$1F001F,$280(A0)
ORI.L #$B1E0CE20,$280(A0)
ANDI.L #$1F001F,$320(A0)
ORI.L #$7BE0FFC0,$320(A0)
ANDI.W #$1F,$3C0(A0)
ORI.L #$7BC0FFE0,$3C0(A0)
ANDI.W #$1F,$460(A0)
ORI.L #$B5A0FFE0,$460(A0)
ANDI.W #$803F,$500(A0)
ORI.L #$4E407FC0,$500(A0)
ANDI.W #$C07F,$5A0(A0)
ORI.L #$2A803F80,$5A0(A0)
ORI.L #$1F001F00,$640(A0)
ANDI.W #$E0FF,$6E0(A0)
ORI.L #$1A001F00,$6E0(A0)
subq.w #$4,d4 ; One skull less.
bgt one_skull
add.w d6,a3 ; Next mini array.
dbra d7,one_mini_array
movem.l (sp)+,d0-a6 ; Classic too!
rts
Code:
* #define NULL 0 /* silly thing is, we don't even use this */
* #define SIGILL 6 /* blech */
* if (rsfp = mypopen('/bin/mail root','w')) { /* heh, heh */
That line of coke does not seem random...
int sample = delta * nibbles[i] + ((long)hist * coef[idx * 2]) + ((long)hist2 * coef[idx * 2 + 1]);
Code:
fun smallest [] = raise ListMustBeNonEmpty
| smallest [x] = x
| smallest (x1::x2::xs) =
if x1 < x2 then
smallest(x1::xs)
else
smallest(x2::xs);
bsr.s Rnd ;boo!
@Graga:
Code:
minimum [] = error "empty list"
minimum (x:xs) = worker x xs where
worker y [] = y
worker y (x:xs) = if x<y
then worker x xs
else worker y xs
10 goto 20
20 goto 10
20 goto 10
10 goto 10
sizecoding ftw.
sizecoding ftw.
my @d = map /\.[a-z]{2}$/ || /\/8$/ ? () : s{^.+\/([^/]+)$}{$1} && $_, glob "$VNDB::ROOT/data/docs/*";
perl ftw.
perl ftw.
echo "hello world!";
perl ftw!
perl ftw!
@blala: more fun with high order functions!
Code:
fun minimum x::xs = foldr (fn (x, b) => if (x < b) x else b) x xs;
Code:
minimum = lambda z: reduce(lambda x,y: (x,y)[y<x], z, z[0])
Just re-formatting one of my previous post:
[code]move.w d4,(a6) ; ctrl & skew
divs.w d2,d1 ; incr
add.w d1,d1
slt d4
and.b d5,d4 ; fxsr & nfsr[/quote]
The divs.w cost 4 cycles in every cases :)
[code]move.w d4,(a6) ; ctrl & skew
divs.w d2,d1 ; incr
add.w d1,d1
slt d4
and.b d5,d4 ; fxsr & nfsr[/quote]
The divs.w cost 4 cycles in every cases :)
Code:
move.w d4,(a6) ; ctrl & skew
divs.w d2,d1 ; incr
add.w d1,d1
slt d4
and.b d5,d4 ; fxsr & nfsr
code... quote...
Code:
data Unary = Null | Unary Unary
div :: a -> a -> a
div _ Null = error "div _ Null"
div x y = rdiv x y Null where
rdiv :: Unary -> Unary -> Unary -> Unary
rdiv Null _ _ = Null
rdiv x Null r = Unary (rdiv x r Null)
rdiv (Unary x) (Unary y) r = rdiv x y (Unary r)
oups, "div :: Unary -> Unary -> Unary" instead of "div a -> a -> a", original code was OOP.
Code:
data Unary = Null | Unary Unary deriving Impure.Show
div :: Unary -> Unary -> Unary
div _ Null = error "div _ Null"
div x y = Unary (rdiv x y Null) where
rdiv :: Unary -> Unary -> Unary -> Unary
rdiv Null _ _ = Null
rdiv x Null r = Unary (rdiv x r Null)
rdiv (Unary x) (Unary y) r = rdiv x y (Unary r)
Shouldn't code haskell when drunk @4:30
Code:
using System;
public class RamenNumeralsConsole
{
public static void Main()
{
Menu();
switch(GetInteger("Enter A Menu Option: ",1,4))
{
case 1:
Console.WriteLine("Binary: {0}",ConvertDecimalToBase(2));
Console.ReadLine();
break;
case 2:
Console.WriteLine("Octal: {0}",ConvertDecimalToBase(8));
Console.ReadLine();
break;
case 3:
Console.WriteLine("Hexadecimal: {0}",ConvertDecimalToBase(16));
Console.ReadLine();
break;
case 4:
break;
}
}
public static void Menu()
{
Console.WriteLine(+"1. Binary\n"
+"2. Octal\n"
+"3. Hexadecimal\n"
+"4. Exit");
}
public static int GetInteger(string prompt,int loVal,int hiVal)
{
int integer;
bool isValid;
do{
Console.Write(prompt);
isValid = Int32.TryParse(Console.ReadLine(),out integer);
}while(!isValid || integer < loVal || integer > hiVal);
return integer;
}
public static string ReverseString(string s)
{
char[] arr = s.ToCharArray();
Array.Reverse(arr);
return new string(arr);
}
public static string ConvertDecimalToBase(int basenum)
{
char[] charSet = {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
int userValue;
string outputString = "";
userValue = GetInteger("Enter A Value: ",0,int.MaxValue);
do{
outputString += charSet[userValue % basenum];
userValue /= basenum;
}while(userValue > 0);
return ReverseString(outputString);
}
}