The humble if statement: so simple, so short, so trivial. But do you know how it works? I mean, how it really works? Join us on a trip down the rabbit hole to find out! Our journey will take us from PHP to C, from Assembly to Machine code, from CPU to Transistor and beyond. We'll discover all sorts of interesting things you many never have known about programming, physics and even the universe itself... I can't promise that you'll return from the depths of the CPU, but if you do, you will not be the same.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
require __DIR__ . '/vendor/autoload.php'; | |
$context = new PHPCompiler\Bootstrap\Context; | |
$parser = new PHPCompiler\Bootstrap\Parser($context); | |
$parser->parse(file_get_contents(__DIR__ . "/example.php"), __FILE__); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hex Dec Binary | |
A = A0 160 10100000 | |
B = 4C 76 01001100 | |
0 - A | |
FFFFFF60 -160 1111111101100000 (lowest 16 bits) | |
0 - A - B | |
FFFFFF20 -236 1111111100010100 (lowest 16 bits) | |
Lowest 8 bits of 0-A-B: 00010100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ACTUAL[0000] CASE[10100001 10000010 01001101 11111111 10010001] XOR[0000] ~XOR[1111] SUM[0000] REVSUM[101110] -REVSUM[0010] | |
ACTUAL[0000] CASE[10100001 10000010 01001101 11111111 10000001] XOR[0000] ~XOR[1111] SUM[0000] REVSUM[101110] -REVSUM[0010] | |
ACTUAL[0000] CASE[10100001 11000010 01001100 11111111 11111111] XOR[1111] ~XOR[0000] SUM[1101] REVSUM[101101] -REVSUM[0011] | |
ACTUAL[0000] CASE[10100001 10000010 01001100 11111111 11111111] XOR[1111] ~XOR[0000] SUM[1101] REVSUM[101101] -REVSUM[0011] | |
ACTUAL[0000] CASE[10100001 10100011 01001101 11111111 11111111] XOR[1111] ~XOR[0000] SUM[1111] REVSUM[111101] -REVSUM[0011] | |
ACTUAL[0000] CASE[10100001 10010011 01001101 11111111 11111111] XOR[1111] ~XOR[0000] SUM[1111] REVSUM[111101] -REVSUM[0011] | |
ACTUAL[0001] CASE[10100001 10100011 01001100 11111111 11111111] XOR[1110] ~XOR[0001] SUM[1110] REVSUM[110101] -REVSUM[1011] | |
ACTUAL[0001] CASE[10100001 11000010 01001101 11111111 11111111] XOR[1110] ~XOR[0001] SUM[1110] REVSUM[110101] -REVSUM[1011] | |
ACTUAL[0001] CASE[10100001 1000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Toggle Swing: 10100010 00000001 | |
Toggle LED: 10100010 00001000 | |
Set Temp + Mode | |
Byte 1: 10100001 | |
Byte 2: | |
|--------|--------|--------|--------|--------|--------|--------|--------| | |
| POWER | SLEEP | Fan 0 | Fan 1 | FAN 2 | MODE 0 | MODE 1 | MODE 2 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
interface Lock { | |
public function advisory(string $identifier): LockContext; | |
public function exclusive(string $identifier): LockContext; | |
public function waitForAdvisory(string $identifier, int $timeout = 0): \Generator; | |
public function waitForExclusive(string $identifier, int $timeout = 0): \Generator; | |
} | |
interface LockContext { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "pins_arduino.h" | |
#include "SPI_USART.h" | |
uint8_t SPIUsartClass::ss[SPIUSART_COUNT]; | |
void SPIUsartClass::begin(uint8_t _usart, uint8_t _ss) { | |
if (_usart > SPIUSART_COUNT) { | |
return; | |
} | |
ss[_usart] = _ss; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.offset 0xC000 | |
boot: | |
MOV RJ1, 0x00; | |
MOV RJ2, 0x00; | |
MOV RA, 0xD0; | |
STORE RA; | |
MOV RJ2, 0x01; | |
MOV RA, 0x00; | |
STORE RA; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function doStuff() { | |
//blah | |
//blah | |
if (!$this->isWhateverCondition(blah, blah, blah)) { | |
return false; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$a = 1; | |
if ($a > 1) { | |
$b = 2; | |
} else { | |
$b = 3; | |
} |
NewerOlder