/[svn]/libgig/trunk/src/helper.h
ViewVC logotype

Diff of /libgig/trunk/src/helper.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3729 by schoenebeck, Sat Feb 23 16:12:08 2019 UTC revision 3730 by schoenebeck, Sat Feb 1 12:06:25 2020 UTC
# Line 2  Line 2 
2   *                                                                         *   *                                                                         *
3   *   libgig - C++ cross-platform Gigasampler format file access library    *   *   libgig - C++ cross-platform Gigasampler format file access library    *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003-2019 by Christian Schoenebeck                      *   *   Copyright (C) 2003-2020 by Christian Schoenebeck                      *
6   *                              <cuse@users.sourceforge.net>               *   *                              <cuse@users.sourceforge.net>               *
7   *                                                                         *   *                                                                         *
8   *   This library is free software; you can redistribute it and/or modify  *   *   This library is free software; you can redistribute it and/or modify  *
# Line 150  inline void store32(uint8_t* pData, uint Line 150  inline void store32(uint8_t* pData, uint
150  }  }
151    
152  /**  /**
153     * Stores a 64 bit integer in memory using little-endian format.
154     *
155     * @param pData - memory pointer
156     * @param data  - integer to be stored
157     */
158    inline void store64(uint8_t* pData, uint64_t data) {
159        pData[0] = data;
160        pData[1] = data >> 8;
161        pData[2] = data >> 16;
162        pData[3] = data >> 24;
163        pData[4] = data >> 32;
164        pData[5] = data >> 40;
165        pData[6] = data >> 48;
166        pData[7] = data >> 56;
167    }
168    
169    /**
170   * Loads a 16 bit integer in memory using little-endian format.   * Loads a 16 bit integer in memory using little-endian format.
171   *   *
172   * @param pData - memory pointer   * @param pData - memory pointer
# Line 417  inline std::string concatPath(const std: Line 434  inline std::string concatPath(const std:
434          : path1 + path2;          : path1 + path2;
435  }  }
436    
437    /**
438     * Returns a hex string representation of the binary data being passed.
439     */
440    inline std::string binToHexStr(const void* pData, size_t sz) {
441        std::string s;
442        for (size_t i = 0; i < sz; ++i) {
443            s += strPrint("%02x", ((const char*)pData)[i]);
444        }
445        return s;
446    }
447    
448  #endif // __LIBGIG_HELPER_H__  #endif // __LIBGIG_HELPER_H__

Legend:
Removed from v.3729  
changed lines
  Added in v.3730

  ViewVC Help
Powered by ViewVC