fork(6) download
  1. #include <iostream>
  2. #include <cstdint>
  3. #include <bitset>
  4. using namespace std;
  5.  
  6. int main() {
  7. std::bitset<32> b("10100000001000011111111111111111");
  8. int16_t x16 = (int16_t)(b.to_ulong() & 0xFFFF);
  9. int32_t x32 = (int32_t)b.to_ulong();
  10. cout << x16 << endl;
  11. cout << x32 << endl;
  12. return 0;
  13. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
-1
-1608384513