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
uint64_t f64(uint64_t x, uint64_t y) { | |
return y * (2 - y * x); | |
} | |
static uint64_t inverse64(uint64_t x) { | |
uint64_t y = x; | |
y = f64(x, y); | |
y = f64(x, y); | |
y = f64(x, y); | |
y = f64(x, y); |
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
q = x >> 32 | |
r = x - (q << 32) | |
i = 0 | |
while (q > 0) { | |
t = (q << 4) - q | |
q = t >> 32 | |
r_i = t - (q << 32) | |
if (++i % 2 == 1) | |
r -= r_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
Spinal Codes (totally metal name) | |
Paper: http://nms.csail.mit.edu/papers/fp049-perry.pdf | |
This is a bitwise error correction code that can correct bit errors anywhere in the message. | |
It is not MDS and the strength of the code includes the processing time allowed for decoding. | |
More discussion at the end. | |
Simple version of the algorithm: |
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
//------------------------------------------------------------------------------ | |
// Intrinsics | |
/// Returns first position with set bit (LSB = 0) | |
/// Precondition: x != 0 | |
TONK_FORCE_INLINE unsigned NonzeroLowestBitIndex(uint32_t x) | |
{ | |
#ifdef _MSC_VER | |
unsigned long index; | |
// Note: Ignoring result because x != 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
{d-Connection} [127.0.0.1:1] Connection::OnTimeSync(ReceivedBPS=105088, LossRate=0) | |
{d-Connection} [127.0.0.1:1] Connection::OnTimeSync(ReceivedBPS=129088, LossRate=0) | |
{d-Connection} [127.0.0.1:1] Connection::OnTimeSync(ReceivedBPS=129088, LossRate=0) | |
{d-Connection} [127.0.0.1:1] Connection::OnTimeSync(ReceivedBPS=113088, LossRate=0.125) | |
{d-Connection} [127.0.0.1:1] Connection::OnTimeSync(ReceivedBPS=113088, LossRate=0.125) | |
{d-Connection} [127.0.0.1:1] Connection::OnTimeSync(ReceivedBPS=98944, LossRate=0.230469) | |
Got router queue filling up simulation working | |
My crappy current CC increases the send rate to 129KB/S until the queue fills up (filling 1 MB buffer) and data starts dropping off the back | |
Then CC detects loss and sets send rate lower |
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
/* Scan input and build symbol stats */ | |
{ CHECK_V_F(largest, FSE_count_wksp (table->count, &maxSymbolValue, (const BYTE*)src, srcSize, table->count) ); | |
if (largest == srcSize) { *ostart = ((const BYTE*)src)[0]; return 1; } /* single symbol, rle */ | |
if (largest <= (srcSize >> 7) + 1) { | |
return 0; /* heuristic : probably not compressible enough */ | |
} | |
/* Added this more accurate heuristic to handle high entropy data properly -catid */ | |
U64 total = 0; | |
U64 sum_clogc = 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
#pragma once | |
#include "xxxxxxxxxProtocol.h" | |
#include "xxxxxxxxxTools.h" | |
#define ZSTD_STATIC_LINKING_ONLY /* Enable advanced API */ | |
#include "thirdparty/zstd/zstd.h" // Zstd | |
#include "thirdparty/zstd/zstd_errors.h" | |
namespace xxx { |
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
/** | |
RoughStrCompare() | |
This does a rough ASCII case-insensitive string comparison. Mainly for fun. | |
All of the a-z and A-Z ASCII codes are between 0x41 - 0x5A and 0x61 - 0x7A. | |
The idea here is to mask out 0x20 to make these equivalent (case-insensitive) | |
but the problem with this idea is that it aliases these characters: | |
@ with ` [ with { \ with | ] with } ^ with ~ | |
*/ |
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
PLR FEC PPS ELossMin ELossAvg ELossMax | |
0.01 0.05 333 0.9976 0.999607 1 | |
0.01 0.07 333 0.9985 0.999913 1 | |
0.01 0.06 333 0.998199 0.999829 1 | |
0.01 0.02 333 0.990996 0.994607 0.997599 | |
0.01 0.18 333 0.9994 0.999994 1 | |
0.01 0.12 333 0.9997 0.999997 1 | |
0.01 0.08 333 0.9985 0.999943 1 | |
0.01 0.19 333 1 1 1 | |
0.01 0.04 333 0.9952 0.998767 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
PLR FEC PPS ELossMin ELossAvg ELossMax | |
0.01 0.05 333 0.9976 0.999607 1 | |
0.01 0.07 333 0.9985 0.999913 1 | |
0.01 0.06 333 0.998199 0.999829 1 | |
0.01 0.02 333 0.990996 0.994607 0.997599 | |
0.01 0.18 333 0.9994 0.999994 1 | |
0.01 0.12 333 0.9997 0.999997 1 | |
0.01 0.08 333 0.9985 0.999943 1 | |
0.01 0.19 333 1 1 1 | |
0.01 0.04 333 0.9952 0.998767 1 |