[PR #122] Fix vs2010 #735

Open
opened 2026-01-29 20:50:36 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/google/brotli/pull/122

State: closed
Merged: No


I get the following errors on Windows using Visual Studio 2010 when trying to compile the Python extension:

enc/backward_references.cc(26) : error C2124: divide or mod by zero
enc/backward_references.cc(140) : error C3861: 'log2': identifier not found
enc/backward_references.cc(145) : error C3861: 'log2': identifier not found

The patch tries to fix both issues.

For the kInfinity constant, I use std::numeric_limits::infinity as found in the <limits> header.

For the log2 function (missing from Visual Studio 2010) which is used in backward_references.cc, I define a new _log2 function inside fast_log.h. This MSVC specific workaround was previously incorporated in the FastLog2 function, so I just extracted it from there.

We need to support Visual Studio 2010, otherwise it's not possible to compile the Python extension for Windows (Python 3.4 for Windows from Python.org is still built using Visual Studio 2010).

Cheers,

Cosimo

**Original Pull Request:** https://github.com/google/brotli/pull/122 **State:** closed **Merged:** No --- I get the following errors on Windows using Visual Studio 2010 when trying to compile the Python extension: ``` enc/backward_references.cc(26) : error C2124: divide or mod by zero enc/backward_references.cc(140) : error C3861: 'log2': identifier not found enc/backward_references.cc(145) : error C3861: 'log2': identifier not found ``` The patch tries to fix both issues. For the `kInfinity` constant, I use `std::numeric_limits::infinity` as found in the `<limits>` header. For the `log2` function (missing from Visual Studio 2010) which is used in `backward_references.cc`, I define a new `_log2` function inside `fast_log.h`. This MSVC specific workaround was previously incorporated in the `FastLog2` function, so I just extracted it from there. We need to support Visual Studio 2010, otherwise it's not possible to compile the Python extension for Windows (Python 3.4 for Windows from Python.org is still built using Visual Studio 2010). Cheers, Cosimo
claunia added the pull-request label 2026-01-29 20:50:36 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#735