Import Geant4 10.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 12:08:39 +02:00
parent 286caacf06
commit c9b32a6c0a
5770 changed files with 1050949 additions and 367105 deletions
@@ -1,14 +1,14 @@
#ifndef tools_realloc
#define tools_realloc
#include "typedefs"
#include <cstring> //memcpy
namespace tools {
template <class T>
inline bool realloc(T*& a_pointer,uint32 a_new_size,uint32 a_old_size,bool a_init = false) {
inline bool realloc(T*& a_pointer,
unsigned int a_new_size,unsigned int a_old_size,
bool a_init = false) {
if(!a_new_size) {
delete [] a_pointer;
a_pointer = 0;
@@ -16,6 +16,7 @@ inline bool realloc(T*& a_pointer,uint32 a_new_size,uint32 a_old_size,bool a_ini
}
if(!a_pointer) {
a_pointer = new T[a_new_size];
if(!a_pointer) return false;
return true;
}
if(a_old_size==a_new_size) return true;
@@ -28,9 +29,9 @@ inline bool realloc(T*& a_pointer,uint32 a_new_size,uint32 a_old_size,bool a_ini
if(a_new_size>a_old_size) {
::memcpy(pointer,a_pointer,a_old_size*sizeof(T));
if(a_init){
uint32 num = a_new_size-a_old_size;
unsigned int num = a_new_size-a_old_size;
T* pos = pointer+a_old_size;
for(uint32 i=0;i<num;i++,pos++) *pos = T();
for(unsigned int i=0;i<num;i++,pos++) *pos = T();
}
} else {
::memcpy(pointer,a_pointer,a_new_size*sizeof(T));