4 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
$d = "4653896912";
$b = "13";
$z = hexdec(80000000);
print "1: $z\n";
if($z & $d){
$d = ($d>>1);
$d &= (~$z);
$d |= 0x40000000;
$d = ($d>>($b-1));
}else{
$d = ($d>>$b);
}
print "2: $d\n";
?>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/perl
$d = "4653896912";
$b = "13";
$z = hex(80000000);
print "1: $z\n";
if($z & $d){
$d = ($d>>1);
$d &= (~$z);
$d |= 0x40000000;
$d = ($d>>($b-1));
}else{
$d = ($d>>$b);
}
print "2: $d\n";
exit;
1
2
3
4
5
6
7
8
9
10
11
12
13
$d = "4653896912";
$b = "13";
print "1: ",hex(80000000),"\n";
# ehemals im if-block
print "2: $d vor erstem right shift (p.95 camel book)\n";
$d = ($d>>1);
print "2: $d nach erstem und vor zweitem right shift (p.95 camel book)\n";
$d = ($d>>($b-1));
# /ehemals im if-block
print "2: $d\n";
QuoteBe careful, though. Results on large (or negative) numbers may vary depending on the number of bits your machine uses to represent integers.
QuoteWas soll denn das werden? Eine Übung für obfuscated Programming?
4 Einträge, 1 Seite |