v3.8.2 - fix compiler warning, automated wheel builds for Windows and Mac
diff --git a/.travis.yml b/.travis.yml
index 112b434..028910d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,12 +1,45 @@
 language: python
-python:
-  - "2.6"
-  - "2.7"
-  - "3.3"
-  - "3.4"
-  - "3.5"
-  - "pypy"
+cache:
+  directories:
+  - "$HOME/.cache/pip"
+  - "$HOME/.pyenv"
+matrix:
+  include:
+  - os: linux
+    dist: trusty
+    python: '2.6'
+  - os: linux
+    dist: trusty
+    python: '2.7'
+  - os: linux
+    dist: trusty
+    python: '3.3'
+  - os: linux
+    dist: trusty
+    python: '3.4'
+  - os: linux
+    dist: trusty
+    python: '3.5'
+  - os: linux
+    dist: trusty
+    python: pypy
+  - os: osx
+    language: objective-c
+    env: PYENV_VERSION=2.7.11
+  - os: osx
+    language: objective-c
+    env: PYENV_VERSION=3.5.1
+install:
+- "./.travis/install.sh"
 script:
-  - python setup.py build_ext -i
-  - python -m compileall -f .
-  - python setup.py test
+- "./.travis/run.sh"
+deploy:
+  provider: releases
+  api_key:
+    secure: QiadMGAmtPw+Ut7LWqa3U/tImPIgiPH79mM9o8DGBckcacp9HkDYvCGuOjs5hZbCBBuQ6IAkikotS8iCSwHey1GK9jSDbpgKvVGiACdp8HNhitY8V/S3e1UukDlMeu+Q7vCJtynSGX0BJuiOQB8ZQyQ2HEZ7kMQgTLCEO1Uljhc=
+  file: dist/*.whl
+  file_glob: true
+  on:
+    repo: simplejson/simplejson
+    tags: true
+  skip_cleanup: true
diff --git a/.travis/install.sh b/.travis/install.sh
new file mode 100755
index 0000000..2835f82
--- /dev/null
+++ b/.travis/install.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+set -e
+set -x
+
+if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
+    if [ ! -e "$HOME/.pyenv" ]; then
+      git clone https://github.com/yyuu/pyenv.git ~/.pyenv
+    fi
+    PYENV_ROOT="$HOME/.pyenv"
+    PATH="$PYENV_ROOT/bin:$PATH"
+    eval "$(pyenv init -)"
+    hash -r
+    pyenv install --list
+    pyenv install -s $PYENV_VERSION
+    pip install wheel
+fi
diff --git a/.travis/run.sh b/.travis/run.sh
new file mode 100755
index 0000000..4710a2d
--- /dev/null
+++ b/.travis/run.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+set -e
+set -x
+
+if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
+    PYENV_ROOT="$HOME/.pyenv"
+    PATH="$PYENV_ROOT/bin:$PATH"
+    eval "$(pyenv init -)"
+fi
+
+python setup.py build_ext -i
+python -m compileall -f .
+python setup.py test
+
+if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
+  python setup.py bdist_wheel
+fi
diff --git a/CHANGES.txt b/CHANGES.txt
index af8e566..e657176 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,12 @@
+Version 3.8.2 released 2016-02-14
+
+* Fix implicit cast compiler warning in _speedups.c
+* simplejson is now available as wheels for OS X and Windows thanks to Travis-CI
+  and AppVeyor respectively! Many thanks to @aebrahim for getting this party
+  started.
+  https://github.com/simplejson/simplejson/pull/130
+  https://github.com/simplejson/simplejson/issues/122
+
 Version 3.8.1 released 2015-10-27
 
 * Fix issue with iterable_as_array and indent option
diff --git a/conf.py b/conf.py
index d83bca4..8a6a391 100644
--- a/conf.py
+++ b/conf.py
@@ -44,7 +44,7 @@
 # The short X.Y version.
 version = '3.8'
 # The full version, including alpha/beta/rc tags.
-release = '3.8.1'
+release = '3.8.2'
 
 # There are two options for replacing |today|: either, you set today to some
 # non-false value, then it is used:
diff --git a/scripts/artifacts.py b/scripts/artifacts.py
new file mode 100644
index 0000000..48ae2fb
--- /dev/null
+++ b/scripts/artifacts.py
@@ -0,0 +1,48 @@
+try:
+    from urllib.request import urlopen
+except ImportError:
+    from urllib import urlopen
+
+import io
+import json
+import subprocess
+
+
+def get_json(url):
+    return json.load(io.TextIOWrapper(urlopen(url), encoding='utf-8'))
+
+
+def download_file(src_url, dest_path):
+    print(dest_path)
+    subprocess.call(
+        ['curl', '-L', '-#', '-o', dest_path, src_url])
+
+
+def download_appveyor_artifacts():
+    api_url = 'https://ci.appveyor.com/api'
+    builds = get_json(
+        '{}/projects/etrepum/simplejson'.format(api_url))
+
+    for job in builds['build']['jobs']:
+        url = '{api_url}/buildjobs/{jobId}/artifacts'.format(
+            api_url=api_url, **job)
+        for artifact in get_json(url):
+            download_file(
+                '{url}/{fileName}'.format(url=url, **artifact),
+                artifact['fileName'])
+
+
+def download_github_artifacts():
+    release = get_json(
+        'https://api.github.com/repos/simplejson/simplejson/releases/latest')
+    for asset in release['assets']:
+        download_file(asset['url'], 'dist/{name}'.format(**asset))
+
+
+def main():
+    download_appveyor_artifacts()
+    download_github_artifacts()
+
+
+if __name__ == '__main__':
+    main()
diff --git a/setup.py b/setup.py
index a5d3500..1a92c2f 100644
--- a/setup.py
+++ b/setup.py
@@ -11,7 +11,7 @@
     DistutilsPlatformError
 
 IS_PYPY = hasattr(sys, 'pypy_translation_info')
-VERSION = '3.8.1'
+VERSION = '3.8.2'
 DESCRIPTION = "Simple, fast, extensible JSON encoder/decoder for Python"
 
 with open('README.rst', 'r') as f:
diff --git a/simplejson/__init__.py b/simplejson/__init__.py
index c448742..b7fe828 100644
--- a/simplejson/__init__.py
+++ b/simplejson/__init__.py
@@ -97,7 +97,7 @@
     Expecting property name: line 1 column 3 (char 2)
 """
 from __future__ import absolute_import
-__version__ = '3.8.1'
+__version__ = '3.8.2'
 __all__ = [
     'dump', 'dumps', 'load', 'loads',
     'JSONDecoder', 'JSONDecodeError', 'JSONEncoder',
diff --git a/simplejson/_speedups.c b/simplejson/_speedups.c
index 173c5e1..9976464 100644
--- a/simplejson/_speedups.c
+++ b/simplejson/_speedups.c
@@ -2654,7 +2654,7 @@
     if (PyInt_Check(int_as_string_bitcount) || PyLong_Check(int_as_string_bitcount)) {
         static const unsigned int long_long_bitsize = SIZEOF_LONG_LONG * 8;
         int int_as_string_bitcount_val = (int)PyLong_AsLong(int_as_string_bitcount);
-        if (int_as_string_bitcount_val > 0 && int_as_string_bitcount_val < long_long_bitsize) {
+        if (int_as_string_bitcount_val > 0 && int_as_string_bitcount_val < (int)long_long_bitsize) {
             s->max_long_size = PyLong_FromUnsignedLongLong(1ULL << int_as_string_bitcount_val);
             s->min_long_size = PyLong_FromLongLong(-1LL << int_as_string_bitcount_val);
             if (s->min_long_size == NULL || s->max_long_size == NULL) {