- 1
return (m.Id == Id) ? (true) : (false);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+102
return (m.Id == Id) ? (true) : (false);
походу платят за символы
+102
<html class="html">
.............
</html>
Бывает и такое
+102
$compareCost = 0;
$countGacha = 0;
for($i=0; $i<10; ++$i):
$compareCost += $this->freeGacha->getCost();
if( $this->player->getSocialPoint() > $compareCost ) continue;
else break;
$countGacha = $i+1;
endfor;
Korean style ;)
+102
function naq(a:integer;n:integer;m:integer):string;
var astr:string;
begin
astr:=inttostr(a);
case m of
1: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*1)+'*p^'+inttostr(n+1);
2: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*2)+'*p^'+inttostr(n+1)+'+'+inttostr(a*1)+'*p^'+inttostr(n+2);
3: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*3)+'*p^'+inttostr(n+1)+'+'+inttostr(a*3)+'*p^'+inttostr(n+2)+'-'+inttostr(a*1)+'*p^'+inttostr(n+3);
4: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*4)+'*p^'+inttostr(n+1)+'+'+inttostr(a*6)+'*p^'+inttostr(n+2)+'-'+inttostr(a*4)+'*p^'+inttostr(n+3)+'+'+inttostr(a*1)+'*p^'+inttostr(n+4);
5: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*5)+'*p^'+inttostr(n+1)+'+'+inttostr(a*10)+'*p^'+inttostr(n+2)+'-'+inttostr(a*10)+'*p^'+inttostr(n+3)+'+'+inttostr(a*5)+'*p^'+inttostr(n+4)+'-'+inttostr(a*1)+'*p^'+inttostr(n+5);
6: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*6)+'*p^'+inttostr(n+1)+'+'+inttostr(a*15)+'*p^'+inttostr(n+2)+'-'+inttostr(a*20)+'*p^'+inttostr(n+3)+'+'+inttostr(a*15)+'*p^'+inttostr(n+4)+'-'+inttostr(a*6)+'*p^'+inttostr(n+5)+'+'+inttostr(a*1)+'*p^'+inttostr(n+6);
7: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*7)+'*p^'+inttostr(n+1)+'+'+inttostr(a*21)+'*p^'+inttostr(n+2)+'-'+inttostr(a*35)+'*p^'+inttostr(n+3)+'+'+inttostr(a*35)+'*p^'+inttostr(n+4)+'-'+inttostr(a*21)+'*p^'+inttostr(n+5)+'+'+inttostr(a*7)+'*p^'+inttostr(n+6)+'-'+inttostr(a*1)+'*p^'+inttostr(n+7);
8: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*8)+'*p^'+inttostr(n+1)+'+'+inttostr(a*28)+'*p^'+inttostr(n+2)+'-'+inttostr(a*56)+'*p^'+inttostr(n+3)+'+'+inttostr(a*70)+'*p^'+inttostr(n+4)+'-'+inttostr(a*56)+'*p^'+inttostr(n+5)+'+'+inttostr(a*28)+'*p^'+inttostr(n+6)+'-'+inttostr(a*8)+'*p^'+inttostr(n+7)+'+'+inttostr(a*1)+'*p^'+inttostr(n+8);
9: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*9)+'*p^'+inttostr(n+1)+'+'+inttostr(a*36)+'*p^'+inttostr(n+2)+'-'+inttostr(a*84)+'*p^'+inttostr(n+3)+'+'+inttostr(a*126)+'*p^'+inttostr(n+4)+'-'+inttostr(a*126)+'*p^'+inttostr(n+5)+'+'+inttostr(a*84)+'*p^'+inttostr(n+6)+'-'+inttostr(a*36)+'*p^'+inttostr(n+7)+'+'+inttostr(a*9)+'*p^'+inttostr(n+8)+'+'+inttostr(a*1)+'*p^'+inttostr(n+9);
end;
end;
Лень было искать алгоритм раскрытия (1-q)^n
+102
#define HESHELME_BESHELME(x, y) (((x)>0)<<2 | ((y)>0)<<1 | ((x) > ((x)*(y) > 0 ? (y) : -(y))))
двумерное "квантование" точки
+102
const n = 50;
type vec = array [1..n*4] of system.word;
function vprod(const a, b: vec): Cardinal;
var i: longInt;
begin
result := 0;
for i := 1 to high(vec) do inc(result, a[i] * b[i]);
end;
function vprod_asm1(const a, b: vec): Cardinal; assembler;
asm
push ebx
push ecx
push edx
push esi
push edi
xor ebx, ebx
mov ecx, n*4
mov esi, a
mov edi, b
xor eax, eax
cld
@@l:
mov ax, word ptr [esi]
lea esi, [esi+2]
mul word ptr [edi]
lea edi, [edi+2]
shl edx, 16
mov dx, ax
add ebx, edx
dec ecx
jne @@l
mov eax, ebx
pop edi
pop esi
pop edx
pop ecx
pop ebx
end;
function vprod_asm2(const a, b: vec): Cardinal; assembler;
asm
push ebx
push ecx
push edx
push esi
push edi
xor ebx, ebx
mov ecx, n*4
mov esi, a
mov edi, b
xor eax, eax
cld
@@l:
lodsw
movzx edx, WORD PTR [edi]
imul edx
lea edi, [edi+2]
add ebx, eax
loop @@l
mov eax, ebx
pop edi
pop esi
pop edx
pop ecx
pop ebx
end;
function vprod_mmx (const a, b: vec): Cardinal; assembler;
var muls: record l, h: Cardinal end;
asm
push ebx
push ecx
push esi
push edi
mov ecx, n
mov esi, a
mov edi, b
xor eax, eax
lea ebx, muls
@@l:
db $0F,$6F,$06 // movq mm0, [esi]
db $0F,$F5,$07 // pmaddwd mm0, [edi]
lea esi, [esi+8]
db $0F,$7F,$03 // movq [ebx], mm0
lea edi, [edi+8]
add eax, [ebx]
add eax, [ebx+4]
loop @@l
db $0F,$77 // emms
pop edi
pop esi
pop ecx
pop ebx
end;
По просьбам трудящихся публикую модифицированную версию примера MMXTEST.PAS из комплекта компилятора TMT Pascal. Программа находит скалярное произведение двух векторов. Далее должен быть основной блок с фрагментами типа for i := 1 to 100000 do vprod(a, b); , которые я не стал публиковать ввиду ограничений. Функция vprod_asm1 — почти оригинальный код TMT, функция vprod_asm2 — мой оптимизированный вариант. Результаты запуска на двух машинах (таймер получал по RDTSC):
AMD K6-2-333 МГц, FSB 66 МГц.
Delphi7:
Pascal = 0.550 sec.
Asm x86 (original) = 1.034 sec.
Asm x86 (optimized) = 0.490 sec.
Asm MMX = 0.130 sec.
С директивой $O- первый результат 0.853 sec.
Замена loop на dec ecx + jne увеличивает результаты на 0,015 c.
FPC:
Pascal = 1.387 sec.
Asm x86 (original) = 1.199 sec.
Asm x86 (optimized) = 0.510 sec.
Asm MMX = 0.124 sec.
TMT:
Pascal = 0.914 sec.
Asm x86 (original) = 1.037 sec.
Asm x86 (optimized) = 0.494 sec.
Asm MMX = 0.126 sec.
VP:
Pascal = 0.520 sec.
Asm x86 (original) = 1.033 sec.
Asm x86 (optimized) = 0.493 sec.
Asm MMX = 0.146 sec.
С директивами $Q+,R+ первый результат 1.032 sec.
С директивой $Speed- первый результат 0.731 sec.
------------------------------
Celeron 1,86 ГГц, FSB 533 МГц.
Delphi7:
Pascal = 0.025 sec.
Asm x86 (original) = 0.091 sec.
Asm x86 (optimized) = 0.082 sec.
Asm MMX = 0.044 sec.
TMT:
Pascal = 0.109 sec.
Asm x86 (original) = 0.087 sec.
Asm x86 (optimized) = 0.079 sec.
Asm MMX = 0.042 sec.
+102
org.quartz.jobStore.dontSetAutoCommitFalse=true
config boolshit
+102
#define SEVEN_DAYS_SECONDS ((7 * 24 * 60 * 60) + 2)
Нашел в одном проектике.
SEVEN_DAYS_SECONDS используется планировщике заданий.
+102
if (nchan == 1)
{
fprintf(commands_ptr,(char *)"StaNoise sta=%s start_time=%14.3f chan_list=%s window_type=nutall4a sub_window_length=%5.1f main_window_length=%6.1f out_dir=%s plot=yes record=yes decon=%s\n",sta,gmttime,chan_list[0],sub_window_length,main_window_length,out_dir,decon_c);
}
if (nchan == 2)
{
fprintf(commands_ptr,(char *)"StaNoise sta=%s start_time=%14.3f chan_list=%s,%s window_type=nutall4a sub_window_length=%5.1f main_window_length=%6.1f out_dir=%s plot=yes record=yes decon=%s\n",sta,gmttime,chan_list[0],chan_list[1],sub_window_length,main_window_length,out_dir,decon_c);
}
if (nchan == 3)
{
fprintf(commands_ptr,(char *)"StaNoise sta=%s start_time=%14.3f chan_list=%s,%s,%s window_type=nutall4a sub_window_length=%5.1f main_window_length=%6.1f out_dir=%s plot=yes record=yes decon=%s\n",sta,gmttime,chan_list[0],chan_list[1],chan_list[2],sub_window_length,main_window_length,out_dir,decon_c);
}
if (nchan == 4)
{
fprintf(commands_ptr,(char *)"StaNoise sta=%s start_time=%14.3f chan_list=%s,%s,%s,%s window_type=nutall4a sub_window_length=%5.1f main_window_length=%6.1f out_dir=%s plot=yes record=yes decon=%s\n",sta,gmttime,chan_list[0],chan_list[1],chan_list[2],chan_list[3],sub_window_length,main_window_length,out_dir,decon_c);
}
if (nchan == 5)
{
fprintf(commands_ptr,(char *)"StaNoise sta=%s start_time=%14.3f chan_list=%s,%s,%s,%s,%s window_type=nutall4a sub_window_length=%5.1f main_window_length=%6.1f out_dir=%s plot=yes record=yes decon=%s\n",sta,gmttime,chan_list[0],chan_list[1],chan_list[2],chan_list[3],chan_list[4],sub_window_length,main_window_length,out_dir,decon_c);
}
if (nchan == 6)
{
fprintf(commands_ptr,(char *)"StaNoise sta=%s start_time=%14.3f chan_list=%s,%s,%s,%s,%s,%s window_type=nutall4a sub_window_length=%5.1f main_window_length=%6.1f out_dir=%s plot=yes record=yes decon=%s\n",sta,gmttime,chan_list[0],chan_list[1],chan_list[2],chan_list[3],chan_list[4],chan_list[5],sub_window_length,main_window_length,out_dir,decon_c);
}
if (nchan == 7)
{
fprintf(commands_ptr,(char *)"StaNoise sta=%s start_time=%14.3f chan_list=%s,%s,%s,%s,%s,%s,%s window_type=nutall4a sub_window_length=%5.1f main_window_length=%6.1f out_dir=%s plot=yes record=yes decon=%s\n",sta,gmttime,chan_list[0],chan_list[1],chan_list[2],chan_list[3],chan_list[4],chan_list[5],chan_list[6],sub_window_length,main_window_length,out_dir,decon_c);
}
...
}
if (nchan >= 14)
{
fprintf(commands_ptr,(char *)"StaNoise sta=%s start_time=%14.3f chan_list=%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s window_type=nutall4a sub_window_length=%5.1f main_window_length=%6.1f out_dir=%s plot=yes record=yes decon=%s\n",sta,gmttime,chan_list[0],chan_list[1],chan_list[2],chan_list[3],chan_list[4],chan_list[5],chan_list[6],chan_list[7],chan_list[8],chan_list[9],chan_list[10],chan_list[11],chan_list[12],chan_list[13],sub_window_length,main_window_length,out_dir,decon_c);
}
Тяжело в сях работать со строками и переменным числом параметров...
+102
var zaxita, ataka, zaxitacomp, atakacomp, yron, yroncomp: integer;
begin
Label3.Caption := IntToStr(healt);
Label4.Caption := IntToStr(healtcomp);
If Radiobutton1.Checked = True then
begin
zaxita := 1;
yron := 3;
end;
If Radiobutton2.Checked = True then
begin
zaxita := 2;
yron := 2;
end;
If Radiobutton3.Checked = True then
begin
zaxita := 3;
yron := 1;
end;
If Radiobutton4.Checked = True then ataka := 3;
If Radiobutton5.Checked = True then ataka := 2;
If Radiobutton6.Checked = True then ataka := 1;
zaxitacomp := Random(4);
atakacomp := Random(4);
If zaxita <> atakacomp then
begin
healt := healt - yron;
Label3.Caption := IntToStr(healt);
If healt <= 0 then
begin
MessageBeep(48);
ShowMessage('Вы проиграли. Ваш труп скормят крысам!');
Close;
end;
If zaxitacomp <> ataka then
begin
healtcomp := healtcomp - ataka;
Label4.Caption := IntToStr(healtcomp);
If healtcomp <= 0 then
begin
MessageBeep(48);
ShowMessage('Вы выйграли! Поздравляю! Теперь можете разграбить своего врага! О, что это?!');
end;
end;
end;
end;
end.
Это оффлайн симулятор игры карнаж. Игра такая игра