Sha256: ed3332b2c31a5b786b6381c82d459f304816248645136be174e9f8775f245e6f

Contents?: true

Size: 1.12 KB

Versions: 26

Compression:

Stored size: 1.12 KB

Contents

// sass.hpp must go before all system headers to get the
// __EXTENSIONS__ fix on Solaris.
#include "sass.hpp"

#include "base64vlq.hpp"

namespace Sass {

  std::string Base64VLQ::encode(const int number) const
  {
    std::string encoded = "";

    int vlq = to_vlq_signed(number);

    do {
      int digit = vlq & VLQ_BASE_MASK;
      vlq >>= VLQ_BASE_SHIFT;
      if (vlq > 0) {
        digit |= VLQ_CONTINUATION_BIT;
      }
      encoded += base64_encode(digit);
    } while (vlq > 0);

    return encoded;
  }

  char Base64VLQ::base64_encode(const int number) const
  {
    int index = number;
    if (index < 0) index = 0;
    if (index > 63) index = 63;
    return CHARACTERS[index];
  }

  int Base64VLQ::to_vlq_signed(const int number) const
  {
    return (number < 0) ? ((-number) << 1) + 1 : (number << 1) + 0;
  }

  const char* Base64VLQ::CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

  const int Base64VLQ::VLQ_BASE_SHIFT = 5;
  const int Base64VLQ::VLQ_BASE = 1 << VLQ_BASE_SHIFT;
  const int Base64VLQ::VLQ_BASE_MASK = VLQ_BASE - 1;
  const int Base64VLQ::VLQ_CONTINUATION_BIT = VLQ_BASE;

}

Version data entries

26 entries across 17 versions & 2 rubygems

Version Path
sassc-2.3.0 ext/libsass/src/base64vlq.cpp
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/sassc-2.2.1/ext/libsass/src/base64vlq.cpp
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/base64vlq.cpp
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/sassc-2.1.0-x86_64-linux/ext/libsass/src/base64vlq.cpp
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/sassc-2.2.1/ext/libsass/src/base64vlq.cpp
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/sassc-2.1.0-x86_64-linux/ext/libsass/src/base64vlq.cpp
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/base64vlq.cpp
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/sassc-2.2.1/ext/libsass/src/base64vlq.cpp
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/sassc-2.1.0-x86_64-linux/ext/libsass/src/base64vlq.cpp
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/base64vlq.cpp
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/sassc-2.2.1/ext/libsass/src/base64vlq.cpp
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/sassc-2.1.0-x86_64-linux/ext/libsass/src/base64vlq.cpp
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/base64vlq.cpp
sassc-2.2.1 ext/libsass/src/base64vlq.cpp
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/sassc-2.1.0-x86_64-linux/ext/libsass/src/base64vlq.cpp
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/sassc-2.2.0/ext/libsass/src/base64vlq.cpp
sassc-2.2.0 ext/libsass/src/base64vlq.cpp
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/sassc-2.1.0-x86_64-linux/ext/libsass/src/base64vlq.cpp
sassc-2.1.0-x86_64-linux ext/libsass/src/base64vlq.cpp
sassc-2.1.0 ext/libsass/src/base64vlq.cpp