IDConfigBuiltin.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. ///@file Configuration for Inverse Dynamics Library without external dependencies
  2. #ifndef INVDYNCONFIG_BUILTIN_HPP_
  3. #define INVDYNCONFIG_BUILTIN_HPP_
  4. #define btInverseDynamics btInverseDynamicsBuiltin
  5. #ifdef BT_USE_DOUBLE_PRECISION
  6. // choose double/single precision version
  7. typedef double idScalar;
  8. #else
  9. typedef float idScalar;
  10. #endif
  11. // use std::vector for arrays
  12. #include <vector>
  13. // this is to make it work with C++2003, otherwise we could do this
  14. // template <typename T>
  15. // using idArray = std::vector<T>;
  16. template <typename T>
  17. struct idArray {
  18. typedef std::vector<T> type;
  19. };
  20. typedef std::vector<int>::size_type idArrayIdx;
  21. // default to standard malloc/free
  22. #include <cstdlib>
  23. #define idMalloc ::malloc
  24. #define idFree ::free
  25. // currently not aligned at all...
  26. #define ID_DECLARE_ALIGNED_ALLOCATOR() \
  27. inline void* operator new(std::size_t sizeInBytes) { return idMalloc(sizeInBytes); } \
  28. inline void operator delete(void* ptr) { idFree(ptr); } \
  29. inline void* operator new(std::size_t, void* ptr) { return ptr; } \
  30. inline void operator delete(void*, void*) {} \
  31. inline void* operator new[](std::size_t sizeInBytes) { return idMalloc(sizeInBytes); } \
  32. inline void operator delete[](void* ptr) { idFree(ptr); } \
  33. inline void* operator new[](std::size_t, void* ptr) { return ptr; } \
  34. inline void operator delete[](void*, void*) {}
  35. #include "details/IDMatVec.hpp"
  36. #endif