ewma64.hh

来自「COPE the first practical network coding 」· HH 代码 · 共 40 行

HH
40
字号
// -*- c-basic-offset: 4; related-file-name: "../../lib/ewma64.cc" -*-#ifndef CLICK_EWMA64_HH#define CLICK_EWMA64_HH#include <click/confparse.hh>CLICK_DECLSclass DirectEWMA64 { public:    DirectEWMA64()			{ _avg = 0; _ss = 10; }    uint64_t average() const		{ return _avg; }    unsigned stability_shift() const	{ return _ss; }    void set_stability_shift(unsigned ss) { _ss = ss; }    int64_t compensation() const	{ return ((int64_t)1) << (_ss - 1); }    void clear()			{ _avg = 0; }    inline void update_with(uint64_t);    void update_zero_period(unsigned);    String unparse() const;  private:        uint64_t _avg;    unsigned _ss;};inline voidDirectEWMA64::update_with(uint64_t val){    _avg += static_cast<int64_t>(val - _avg + compensation()) >> stability_shift();    // XXX implementation-defined right shift behavior}CLICK_ENDDECLS#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?