Ask Your Question

Does OpenCV runs on platforms with different int size?

asked 2018-02-08 09:22:54 -0500

Pzixel gravatar image

updated 2018-03-05 12:36:42 -0500

I'm writing a library on top of the OpenCV and I have a question about crossplatformability.

So my question is: does OpenCV runs if int size is other than 32 bits, but 16, 64 or 128? Because if yes, I'd like to support those platforms, otherwise it would simplify my high level interfaces.


edit retag flag offensive close merge delete


Hello? Anyone?

Pzixel gravatar imagePzixel ( 2018-02-12 01:27:05 -0500 )edit

@berak can I ask you to visit this question? It seens that it isn't really get enough attention. :(

Pzixel gravatar imagePzixel ( 2018-03-05 11:02:11 -0500 )edit

@Pzixel, a small edit will move it to the front page again ;)

(but i have no knowledge about the problem, sorry ;( )

(i can give you a vote and a hug (but that's all i can do here))

berak gravatar imageberak ( 2018-03-05 11:32:20 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2018-03-05 14:17:47 -0500

mshabunin gravatar image

updated 2018-03-05 19:15:10 -0500

The _int_ type is assumed to be 4-bytes wide:

I think there is no explicit check anywhere, but implicit assumption can be found in many places:

  • bit shifts and masks; not sure if this function will work with 64-bit int, but it will definitely broke for 16-bit.
  • we have generic 128-bit SIMD C++ implementation which assumes 128-bit register = 4 x int values
  • some algorithms use SoftFloat library with assumption int = int32_t (example)
  • ...
  • the type identifier for int matrices is named CV_32S
edit flag offensive delete link more


Hmm, I see a comment that says that int should be 4 bytes but I don't see any macro or something enforcing this rule (e.g. using int32_t instead of int). Can you elaborate a bit more, please?

Pzixel gravatar imagePzixel ( 2018-03-05 14:33:42 -0500 )edit

I've added some thoughts to the answer

mshabunin gravatar imagemshabunin ( 2018-03-05 19:15:28 -0500 )edit

Question Tools

1 follower


Asked: 2018-02-08 09:22:54 -0500

Seen: 162 times

Last updated: Mar 05 '18