diff --git a/src/IVtk/IVtk_Types.hxx b/src/IVtk/IVtk_Types.hxx index c9aaad23fe..862222b0cb 100644 --- a/src/IVtk/IVtk_Types.hxx +++ b/src/IVtk/IVtk_Types.hxx @@ -1,7 +1,7 @@ -// Created on: 2011-10-11 +// Created on: 2011-10-11 // Created by: Roman KOZLOV -// Copyright (c) 2011-2014 OPEN CASCADE SAS -// +// Copyright (c) 2011-2014 OPEN CASCADE SAS +// // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under @@ -21,11 +21,22 @@ #include #include #include -#include #include +#include +#include -typedef Standard_Size IVtk_IdType; +#ifdef VTK_USE_64BIT_IDS +#if defined(_WIN32) && !defined(_WIN64) +#error "64-bit VTK library can not be linked for 32-bit target platform" +#endif +#else +#ifdef _WIN64 +#error "32-bit VTK library can not be linked for 64-bit target platform" +#endif +#endif + +typedef vtkIdType IVtk_IdType; typedef IVtk_IdType IVtk_PointId; typedef IVtk_IdType IVtk_FaceId; @@ -39,6 +50,7 @@ typedef NCollection_Map IVtk_IdTypeMap; typedef NCollection_List IVtk_Pnt2dList; + //! @enum IVtk_SelectionMode Selection modes for 3D shapes //! //! Enumeration that describes all supported selection modes for 3D shapes. diff --git a/src/Standard/Standard_Integer.hxx b/src/Standard/Standard_Integer.hxx index 6d5261136f..a8ee8f8932 100755 --- a/src/Standard/Standard_Integer.hxx +++ b/src/Standard/Standard_Integer.hxx @@ -25,8 +25,8 @@ // ------------------------------------------------------------------ // Abs : Returns the absolute value of an Integer // ------------------------------------------------------------------ -inline Standard_Integer Abs (const Standard_Integer Value) -{ +inline Standard_Integer Abs (const Standard_Integer Value) +{ return Value >= 0 ? Value : -Value; } @@ -49,6 +49,15 @@ inline Standard_Boolean IsEqual (const Standard_Integer theOne, return theOne == theTwo; } +// ------------------------------------------------------------------ +// Hascode : Computes a hascoding value for a given long long integer +// ------------------------------------------------------------------ +inline Standard_Integer HashCode(const long long int theMe, + const Standard_Integer theUpper) +{ + return ((theMe & 0x7fffffffffffffff) % theUpper) + 1; +} + #if (defined(_LP64) || defined(__LP64__) || defined(_WIN64)) || defined(__APPLE__) // ------------------------------------------------------------------ // Hascode : Computes a hascoding value for a given unsigned integer @@ -72,21 +81,21 @@ inline Standard_Boolean IsEqual (const Standard_Utf32Char theOne, // ------------------------------------------------------------------ // IsEven : Returns Standard_True if an integer is even // ------------------------------------------------------------------ -inline Standard_Boolean IsEven (const Standard_Integer Value) +inline Standard_Boolean IsEven (const Standard_Integer Value) { return Value % 2 == 0; } // ------------------------------------------------------------------ // IsOdd : Returns Standard_True if an integer is odd // ------------------------------------------------------------------ -inline Standard_Boolean IsOdd (const Standard_Integer Value) +inline Standard_Boolean IsOdd (const Standard_Integer Value) { return Value % 2 == 1; } // ------------------------------------------------------------------ // Max : Returns the maximum integer between two integers // ------------------------------------------------------------------ inline Standard_Integer Max (const Standard_Integer Val1, - const Standard_Integer Val2) + const Standard_Integer Val2) { return Val1 >= Val2 ? Val1 : Val2; } @@ -94,8 +103,8 @@ inline Standard_Integer Max (const Standard_Integer Val1, // ------------------------------------------------------------------ // Min : Returns the minimum integer between two integers // ------------------------------------------------------------------ -inline Standard_Integer Min (const Standard_Integer Val1, - const Standard_Integer Val2) +inline Standard_Integer Min (const Standard_Integer Val1, + const Standard_Integer Val2) { return Val1 <= Val2 ? Val1 : Val2; } @@ -103,32 +112,32 @@ inline Standard_Integer Min (const Standard_Integer Val1, // ------------------------------------------------------------------ // Modulus : Returns the remainder of division between two integers // ------------------------------------------------------------------ -inline Standard_Integer Modulus (const Standard_Integer Value, - const Standard_Integer Divisor) +inline Standard_Integer Modulus (const Standard_Integer Value, + const Standard_Integer Divisor) { return Value % Divisor; } // ------------------------------------------------------------------ // Square : Returns the square of an integer // ------------------------------------------------------------------ -inline Standard_Integer Square(const Standard_Integer Value) +inline Standard_Integer Square(const Standard_Integer Value) { return Value * Value; } // ------------------------------------------------------------------ // IntegerFirst : Returns the minimum value of an integer // ------------------------------------------------------------------ -inline Standard_Integer IntegerFirst() +inline Standard_Integer IntegerFirst() { return INT_MIN; } // ------------------------------------------------------------------ // IntegerLast : Returns the maximum value of an integer // ------------------------------------------------------------------ -inline Standard_Integer IntegerLast() +inline Standard_Integer IntegerLast() { return INT_MAX; } // ------------------------------------------------------------------ // IntegerSize : Returns the size in digits of an integer // ------------------------------------------------------------------ -inline Standard_Integer IntegerSize() +inline Standard_Integer IntegerSize() { return BITS(Standard_Integer); } -#endif +#endif