⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bitsubsetgray.h

📁 the FXT library: fast transforms and low level algorithms. The package contains many algorithms for
💻 H
字号:
#if !defined HAVE_BITSUBSETGRAY_H__#define      HAVE_BITSUBSETGRAY_H__#include "bits/graycode.h"#include "fxttypes.h"class bit_subset_gray// generate all all subsets of bits of  a given word// in minimal-change (Gray code) order.//// e.g. for the word ('.' printed for unset bits)//   ...11.1.// these words are produced by subsequent next()-calls://   ......1.//   ....1...//   ....1.1.  *** NOT a Gray code in geenral ***//   ...11...//   ...11.1.//   ...1....//   ...1..1.//   ........//{public:    ulong u_, v_;public:    bit_subset_gray(ulong v) : u_(0), v_(v)  { ; }    ~bit_subset_gray() { ; }    ulong current()  const { return u_; }    ulong out(ulong x)  { return gray_code(x) & v_; }    ulong next()  { u_ = (u_ - v_) & v_;  return out(u_); }    ulong prev()  { u_ = (u_ - 1 ) & v_;  return out(u_); }};// -------------------------#endif  // !defined HAVE_BITSUBSETGRAY_H__

⌨️ 快捷键说明

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