[PR #122] [CLOSED] Fix vs2010 #731

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

📋 Pull Request Information

Original PR: https://github.com/google/brotli/pull/122
Author: @anthrotype
Created: 6/26/2015
Status: Closed

Base: masterHead: fix_vs2010


📝 Commits (3)

  • 2f15f05 [backward_references] use std::numeric_limits::infinity
  • 9630530 [fast_log] define _log2 function compatible with VisualStudio 2010
  • dd56371 [backward_references] use _log2 function compatible with Visual Studio 2010

📊 Changes

2 files changed (+18 additions, -12 deletions)

View changed files

📝 enc/backward_references.cc (+5 -3)
📝 enc/fast_log.h (+13 -9)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/google/brotli/pull/122 **Author:** [@anthrotype](https://github.com/anthrotype) **Created:** 6/26/2015 **Status:** ❌ Closed **Base:** `master` ← **Head:** `fix_vs2010` --- ### 📝 Commits (3) - [`2f15f05`](https://github.com/google/brotli/commit/2f15f05d4964c0416bfa1c96c5834f082afe66eb) [backward_references] use std::numeric_limits::infinity - [`9630530`](https://github.com/google/brotli/commit/9630530a6fe68b46fe6b4ad5babde5b02254005b) [fast_log] define _log2 function compatible with VisualStudio 2010 - [`dd56371`](https://github.com/google/brotli/commit/dd5637126d6ceb0e4df14b8edaa27e7fe59e818b) [backward_references] use _log2 function compatible with Visual Studio 2010 ### 📊 Changes **2 files changed** (+18 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `enc/backward_references.cc` (+5 -3) 📝 `enc/fast_log.h` (+13 -9) </details> ### 📄 Description 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 20:50:35 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#731