1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-05-16 10:54:53 +03:00

0026668: Eliminate compile warnings obtained by building occt with vc14: conversion requires a narrowing conversion

Warnings "conversion requires a narrowing conversion" were eliminated: IVtk_IdType is defined via vtkIdType from now.

Check of bitness of VTK libraries is added, to ensure that OCCT and VTK use the same bitness.

HashCode() function for long long int added in Standard_Integer.hxx to handle 64-bit integers
This commit is contained in:
rkv 2015-09-30 09:36:04 +03:00 committed by bugmaster
parent 839b8d3cdf
commit ee9e67edc7
2 changed files with 40 additions and 19 deletions

View File

@ -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 <NCollection_TListIterator.hxx>
#include <NCollection_DataMap.hxx>
#include <NCollection_Map.hxx>
#include <Standard_Integer.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <vtkType.h>
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_IdType> IVtk_IdTypeMap;
typedef NCollection_List <gp_XY> IVtk_Pnt2dList;
//! @enum IVtk_SelectionMode Selection modes for 3D shapes
//!
//! Enumeration that describes all supported selection modes for 3D shapes.

View File

@ -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