📄 cb_add_0.cc
字号:
// file: circular_buffer/cb_add_cc.cc//// isip include files//#include "CircularBuffer.h"// method: add//// arguments: //// int dim: (input) dimensions of circular buffer// float_8 new_value: (input) new value that will be added in//// return: int indicating the current pointer//// this method adds new value to the back circular buffer.//int Circular_buffer::add_cc(int dim, float_8 new_value) { // increment the pointer // idx_d[dim]++; if (++num_d[dim] > size_d) { num_d[dim] = size_d; } int idx = idx_d[dim]; if (idx >= size_d) {idx -= size_d;} else if (idx < (int)0) {idx += size_d;} // assign the value // buf_d[dim][idx] = new_value; idx_d[dim] = idx; // return the new pointer // return idx;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -