本文整理汇总了C++中std::bitset::to_ulong方法的典型用法代码示例。如果您正苦于以下问题:C++ bitset::to_ulong方法的具体用法?C++ bitset::to_ulong怎么用?C++ bitset::to_ulong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::bitset
的用法示例。
在下文中一共展示了bitset::to_ulong方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: populateStates
void Converter::populateStates()
{
static std::bitset<32> accessor = 1;
static std::bitset<32> accepting = 0;
for (auto s : this->original.getStates())
{
this->originalStates[s.first] = std::pair<State*, std::bitset<32> >(s.second, accessor);
// if it is an accepting state, add the accessor position
// to the accepting bitset and set its state to accepting
if (s.second->isAccepting() == true)
{
accepting |= accessor;
}
accessor <<= 1; //bit shift by 1
}
this->totalStates = accessor.to_ulong();
//total number of elements of the powerset is final offset - 1
for (int i = 0; i < this->totalStates; i++)
{
this->newStates[i] = new State(std::bitset<32>(i).to_string());
//compare if any of the accepting bits is set
std::bitset<32> check = accepting & std::bitset<32>(i);
if (check.any())
{
this->newStates[i]->setAccepting(true);
}
}
}
示例2: configure
//set operation mode of adc
void Vflyspi_adc::configure( std::bitset<3> test_pattern ) {
// Testpatterns are:
// 000 Normal operation - <D13:D0> = ADC output
// 001 All zeros - <D13:D0> = 0x0000
// 010 All ones - <D13:D0> = 0x3FFF
// 011 Toggle pattern - <D13:D0> toggles between 0x2AAA and 0x1555
// 100 Digital ramp - <D13:D0> increments from 0x0000 to 0x3FFF by one code every cycle
// 101 Custom pattern - <D13:D0> = contents of CUSTOM PATTERN registers
// 110 Unused
// 111 Unused
Logger& log = Logger::instance();
log(Logger::DEBUG0) << "Setting ADC input to: " << test_pattern.to_string();
sp6data* buf = writeBlock(0,18);//just a large one
*(buf++) = ocpwrite | 0x3008; *(buf++) = 0x08; //start clock
*(buf++) = ocpwrite | 0x3008; *(buf++) = 0xe8; //release pdn and reset for adc, no start signal yet
*(buf++) = ocpwrite | 0x1c00; *(buf++) = 0x10; //software reset
*(buf++) = ocpwrite | 0x1c01; *(buf++) = 0x4; //enable lvds interface, disable clock
// ocp.write(0x1c00|(0xe<<3)|2,0x81); //7mA, 100Ohm
*(buf++) = ocpwrite | 0x1c00|(0xe<<3); *(buf++) = 0xc; //lowest power lvds is 0xc
*(buf++) = ocpwrite | 0x1c00|(0x4<<3)|0; *(buf++) = 0x0; //clock edge
*(buf++) = ocpwrite | 0x1c00|(0xb<<3)|1; *(buf++) = 0x54; //custom pattern 0x555 ->datablatt wrong!!!
*(buf++) = ocpwrite | 0x1c00|(0xc<<3)|0; *(buf++) = 0x05; //custom pattern 0x555 ->datablatt wrong!!!
*(buf++) = ocpwrite | 0x1c00|(0xa<<3)|4; *buf =test_pattern.to_ulong()<<5; //enable ramp test pattern with 0x80, custom with 0xa0
doWB();
}
示例3: blendChannels
void blendChannels(
Texture* dest,
std::bitset<4> mask,
Texture* src,
int ch, float blend)
{
_launchThreadsCh2Masked<_blendChannels>(ch, mask.to_ulong(), dest, src, blend);
}
示例4: bitset_to_long
long bitset_to_long(const std::bitset<B>& b)
{
struct
{
long x:
B;
} s;
return s.x = b.to_ulong();
}
示例5: _grayCode
void _grayCode(std::vector<int> &ret, std::bitset<32> &bits, int pos) {
if (pos == 0) {
ret.push_back(static_cast<int>(bits.to_ulong()));
return ;
}
_grayCode(ret, bits, n, pos - 1);
bits.flip(pos - 1);
_grayCode(ret, bits, n, pos - 1);
}
示例6: fillWithRevBlendChannel
void fillWithRevBlendChannel(
Texture* dest,
std::bitset<4> mask,
const Eigen::Array4f& color,
Texture* blend_tex,
int blend_ch)
{
_launchThreadsCh2Masked<_blendCwrA>
(blend_ch, mask.to_ulong(), dest, blend_tex, std::ref(color));
}
示例7: makeDelaunay
void makeDelaunay(Texture* tex,
std::vector<std::pair<double, double>>& point_set,
float range,
std::bitset<4> mask)
{
//create the map
Map map(tex->width * 2, tex->height * 2);
std::vector<float> verts;
verts.reserve(point_set.size() * 8);
for(auto& point: point_set)
{
double x = point.first * tex->width;
double y = point.second * tex->height;
map.insertPoint(x, y);
map.insertPoint(x + tex->width, y);
map.insertPoint(x, y + tex->height);
map.insertPoint(x + tex->width, y + tex->height);
verts.push_back(x);
verts.push_back(y);
verts.push_back(x + tex->width);
verts.push_back(y);
verts.push_back(x);
verts.push_back(y + tex->height);
verts.push_back(x + tex->width);
verts.push_back(y + tex->height);
}
Delaunay<float> del(verts);
auto edges = del.triangulate().edges();
for(unsigned i = 0; i < edges.size(); i += 2)
_placeLine(&map,
verts[edges[i] * 2],
verts[edges[i] * 2 + 1],
verts[edges[i + 1] * 2],
verts[edges[i + 1] * 2 + 1]);
map.generateDistances();
if(range > 0)
range *= tex->width < tex->height? tex->width : tex->height;
else range = -range;
_launchThreadsMasked<_writeSDFMap>(mask.to_ulong(), tex, std::move(map), range);
}
示例8: setAddressAsBinary
//Sets address in the binary form
void IPAddress::setAddressAsBinary(std::bitset<32> ip_address)
{
unsigned long int value = ip_address.to_ulong();
setAddressAsUnsignedLongInt(value);
}
示例9: textureDiff
void textureDiff(Texture* dest, Texture* src, std::bitset<4> mask)
{
_launchThreadsMasked<_diffTex>(mask.to_ulong(), dest, src);
}
示例10: channelDiff
void channelDiff(Texture* dest, Texture* src, int ch, std::bitset<4> mask)
{
_launchThreadsCh2Masked<_diffCh>(ch, mask.to_ulong(), dest, src);
}
示例11: mergeTextures
void mergeTextures(Texture* dest, Texture* src, float blend, std::bitset<4> mask)
{
_launchThreadsMasked<_mergeTex>(mask.to_ulong(), dest, src, blend);
}
示例12: blendTexturesWithAlpha
void blendTexturesWithAlpha(
Texture* dest, Texture* src, std::bitset<4> mask, Texture* a_tex, int a_ch)
{
_launchThreadsCh2Masked<_blendTex>(a_ch, mask.to_ulong(), dest, src, a_tex);
}
示例13:
void N2MStandardPacket::set_mode(std::bitset<32> mode)
{
std::lock_guard<std::mutex> packet_lock(packet_mtx);
n2m_standard_packet.mode = mode.to_ulong();
}
示例14: set_steer
void shrimp_gateway_impl::set_steer(short steer) {
if (is_feasible_steer(steer)) {
shrimp_command_t set_steer_command(STEER, write_t, static_cast <all::core::uint8_t> (steer));
send_command(set_steer_command);
//update_control_flags();
//m_control_flags.set(0);
//m_control_flags.set(1);
shrimp_command_t update_steer_command(CONTROL_FLAGS, write_t, static_cast <all::core::uint8_t> (m_control_flags.to_ulong()));
send_command(update_steer_command);
}
else
printf("Steer out of range\n");
}
示例15: enable_voltage_reading
void shrimp_gateway_impl::enable_voltage_reading() {
//update_control_flags();
m_control_flags.set(6);
shrimp_command_t enable_voltage(CONTROL_FLAGS, write_t, static_cast <all::core::uint8_t> (m_control_flags.to_ulong()));
send_command(enable_voltage);
}