ruediger / libbert

A BERT library for C++ and C

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

X_NEW_FLOAT_EXT format

aposto opened this issue · comments


// format.hpp 
#ifndef LIBBERT_NO_EXTENSION
  template < typename Iterator >
  Iterator format_new_float( real_t data, Iterator i ) {
    *i = (byte_t)X_NEW_FLOAT_EXT;
    char buf[8];
    std::copy( reinterpret_cast(&data), reinterpret_cast(&data)+8, buf );
#ifndef LIBBERT_BIGENDIAN
    std::reverse(buf, buf+8);
#endif
    return std::copy( buf, buf+8, i );
  }
#endif