This file contains hidden or 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
Latency Comparison Numbers | |
-------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns | |
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms | |
Read 4K randomly from SSD* 150,000 ns 0.15 ms |
This file contains hidden or 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 <limits.h> /* for CHAR_BIT */ | |
#define BITMASK(b) (1 << ((b) % CHAR_BIT)) | |
#define BITSLOT(b) ((b) / CHAR_BIT) | |
#define BITSET(a, b) ((a)[BITSLOT(b)] |= BITMASK(b)) | |
#define BITCLEAR(a, b) ((a)[BITSLOT(b)] &= ~BITMASK(b)) | |
#define BITTEST(a, b) ((a)[BITSLOT(b)] & BITMASK(b)) | |
#define BITNSLOTS(nb) ((nb + CHAR_BIT - 1) / CHAR_BIT) | |
(If you don't have <limits.h>, try using 8 for CHAR_BIT.) | |
Here are some usage examples. To declare an ``array'' of 47 bits: |
This file contains hidden or 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
/* | |
* My MEM-TEST-SUITE based on Michael Barr code | |
*/ | |
/* badanie zwarc miedzy nogami */ | |
int mem_short_test(U8* saddr, int size) | |
{ | |
char buf[256]; | |
U8 pattern = 0xAA; | |
int addr_mask = size-1; |
This file contains hidden or 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
do { \ | |
pcb->next = *&tcp_bound_pcbs; \ | |
*(&tcp_bound_pcbs) = pcb; \ | |
tcp_timer_needed(); \ | |
} while (0) |
This file contains hidden or 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
var foo = function() { | |
if (typeof foo.i == 'undefined') { | |
foo.i = 0; | |
} | |
++foo.i; | |
return [ function() { | |
return --foo.i; | |
}, |
This file contains hidden or 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 <stdio.h> | |
#include <stdlib.h> | |
void setbit(int* data, char from, char len, int val) | |
{ | |
unsigned int b = ~0; | |
b >>= sizeof(int)*8 - len; | |
*data &= ~(b << from-len); | |
*data |= (val << from-len); | |
} |
This file contains hidden or 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
uint b = 0; | |
uchar k = 0; | |
uchar dop = 0; | |
uchar last_reg = 0; | |
i = 0; | |
uchar reg = 0; | |
// Przepisywanie wartosci do rejestrow | |
/* | |
for (k=0; k<4; ++k) { | |
uchar pelne = roz[k] / 8; |
This file contains hidden or 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
setInterval(function(){ | |
$.ajax({ url: "server", success: function(data){ | |
//Update your dashboard gauge | |
salesGauge.setValue(data.value); | |
}, dataType: "json"}); | |
}, 30000); | |
(function poll(){ | |
setTimeout(function(){ | |
$.ajax({ url: "server", success: function(data){ |
This file contains hidden or 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 <malloc.h> | |
#include <string.h> | |
#include <stdio.h> | |
#define for_each(i, list) \ | |
for(i = list; \ | |
i != NULL; \ | |
i = i->next) | |
struct lista { |
This file contains hidden or 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
<form name="userinfo" method="get" action="info.html"> | |
<p>Please give us your information, so that we can send | |
you spam.</p> | |
<p>Name: <input type="text" name="name"/></p> | |
<p>E-Mail: <input type="text" name="email"/></p> | |
<p>Sex: <select name="sex"> | |
<option>Male</option> | |
<option>Female</option> | |
<option>Other</option> | |
</select></p> |
NewerOlder