SDSL: Succinct Data Structure Library
A C++ template library for succinct data structures
 All Classes Namespaces Files Functions Variables Typedefs Friends
sdsl/include/sdsl/uint128_t.hpp
Go to the documentation of this file.
00001 /* sdsl - succinct data structures library
00002     Copyright (C) 2012 Simon Gog, Matthias Petri
00003 
00004     This program is free software: you can redistribute it and/or modify
00005     it under the terms of the GNU General Public License as published by
00006     the Free Software Foundation, either version 3 of the License, or
00007     (at your option) any later version.
00008 
00009     This program is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012     GNU General Public License for more details.
00013 
00014     You should have received a copy of the GNU General Public License
00015     along with this program.  If not, see http://www.gnu.org/licenses/ .
00016 */
00021 #ifndef INCLUDED_SDSL_UINT128
00022 #define INCLUDED_SDSL_UINT128
00023 
00024 #include <iostream>
00025 #include "bitmagic.hpp"
00026 
00027 namespace sdsl
00028 {
00029 
00030 typedef unsigned int uint128_t __attribute__((mode(TI)));
00031 
00032 std::ostream& operator<<(std::ostream& os, const uint128_t& x)
00033 {
00034     uint64_t X[2] = {(uint64_t)(x >> 64), (uint64_t)x};
00035     for (int j=0; j < 2; ++j) {
00036         for (int i=0; i < 16; ++i) {
00037             os << std::hex << ((X[j]>>60)&0xFULL);
00038             X[j] <<= 4;
00039         }
00040     }
00041     return os;
00042 }
00043 
00044 
00045 } // end namespace
00046 
00047 #endif