X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=ABM2%2FEngine%2Fsingleton.h;h=748414ad43f9ac475bea4c13f4737d5a4f815e91;hb=357a451150c18b27f99cecd5f9d13be1ae5a9fdf;hp=9a40a95e2f5189d91bd2f1bcb50a168c76cfeddb;hpb=0835c5605c80efd286ccb7eff92fffc07689f359;p=matthijs%2FABM2.git diff --git a/ABM2/Engine/singleton.h b/ABM2/Engine/singleton.h index 9a40a95..748414a 100755 --- a/ABM2/Engine/singleton.h +++ b/ABM2/Engine/singleton.h @@ -11,8 +11,10 @@ class Singleton assert(!ms_singleton); //use a cunning trick to get the singleton pointing to the start of the whole, rather than //the start of the Singleton part of the object - int offset = (int)(T*)1 - (int)(Singleton *)(T*)1; - ms_singleton = (T*)((int)this + offset); + // This used to say "int" instead of long, but that breaks + // on 64 bit linux at least + long offset = (long)(T*)1 - (long)(Singleton *)(T*)1; + ms_singleton = (T*)((long)this + offset); } ~Singleton() { @@ -33,4 +35,4 @@ class Singleton template T* Singleton ::ms_singleton = 0; -#endif \ No newline at end of file +#endif