Skip to content

Commit

Permalink
Ancient commit
Browse files Browse the repository at this point in the history
Changes from last year, includes reference mat’s & some unremembered
improvements
  • Loading branch information
CrepeGoat committed Apr 27, 2017
1 parent c425260 commit d6b00b5
Show file tree
Hide file tree
Showing 24 changed files with 1,370 additions and 405 deletions.
Binary file added 10.1.1.108.5117.pdf
Binary file not shown.
Binary file added Figures/figure_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Figures/figure_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions Implementation/Int Encoding/InfIntSequence.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include "InfIntStream.h"
#include <algorithm>

using namespace InfIntStream_NS;

64 changes: 64 additions & 0 deletions Implementation/Int Encoding/InfIntSequence.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@

#ifndef INFUINTSEQUENCE_H
#define INFUINTSEQUENCE_H

using namespace BitSequence_NS;

namespace InfIntSequence_NS {

template <typename ENDIAN>
class InfUintSequence {
BitStream_NS::BitStream<ENDIAN> bseq;

public:
InfUintSequence(byte* const bit_first, byte* const bit_last);
operator bool() const;

bool skip_next();
bool has_next() const;
template <typename UINT>
bool peek_next(UINT& value) const;


// TODO must implement bits-remaining checks
template <typename UINT>
bool operator<<(const UINT& u) {
UINT n;
bool o;
if (u < 3) {
// Treat values <3 as having the most sig. bit
// at bit pos. CHAR_BIT*sizeof(UINT)
n = CHAR_BIT*sizeof(UINT);
o=false;
} else {
n = u;
for (std::size_t i=1; i<CHAR_BIT*sizeof(UINT); i<<=1) {
n |= n>>i;
}
n^=(n>>1);
o = u & (n>>1);
n = get_bit_pos(n);
}
if (!bseq.has_next(2*n+o-3)) return false;
bseq.set(true,n+o-3);
bseq << false;
bseq << !o;
bseq.set(u, n-2);

return *this;
}
template <typename UINT>
bool operator>>(UINT& u) {
std::size_t n;
bool o;
n = bseq.get(true);
bseq.skip_next();
bseq >> o;

u=0;
bseq.get(u,n+o);
u+=(UINT(3)+o)<<n;
}
};
}
#endif
29 changes: 29 additions & 0 deletions Implementation/divide_non_negative_remainder.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#ifndef DIVIDE_NON_NEGATIVE_REMAINDER_H
#define DIVIDE_NON_NEGATIVE_REMAINDER_H

#include <limits>

template <typename SINT>
void divide_w_nneg_remainder(const SINT& dividend, const SINT& divisor,
SINT& quotient, SINT& remainder) {
quotient = dividend / divisor;
remainder = dividend % divisor;
if ((!std::numeric_limits<SINT>::is_specialized || std::numeric_limits<SINT>::is_signed) && remainder<0) {
--quotient;
remainder+=divisor;
}
}
template <typename SINT>
SINT quotient_w_nneg_remainder(const SINT& dividend, const SINT& divisor) {
SINT quotient, tmp;
divide_w_pos_remainder(dividend, divisor, quotient, tmp);
return quotient;
}
template <typename SINT>
SINT nneg_remainder(const SINT& dividend, const SINT& divisor) {
SINT tmp, remainder;
divide_w_pos_remainder(dividend, divisor, tmp, remainder);
return remainder;
}

#endif
194 changes: 0 additions & 194 deletions Implementation/rational.cpp

This file was deleted.

95 changes: 0 additions & 95 deletions Implementation/rational.h

This file was deleted.

Loading

0 comments on commit d6b00b5

Please sign in to comment.