/* Generated by Cython 0.16 on Wed Apr 25 13:44:36 2012 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02040000
    #error Cython requires Python 2.4+.
#else
#include <stddef.h> /* For offsetof */
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif

#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif

#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif

#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif

#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif

#ifdef PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif

#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyCFunction_Call PyObject_Call
#else
  #define __Pyx_PyCFunction_Call PyCFunction_Call
#endif

#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PY_FORMAT_SIZE_T ""
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)   __Pyx_PyInt_AsInt(o)
  #define PyNumber_Index(o)    PyNumber_Int(o)
  #define PyIndex_Check(o)     PyNumber_Check(o)
  #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
  #define __PYX_BUILD_PY_SSIZE_T "i"
#else
  #define __PYX_BUILD_PY_SSIZE_T "n"
#endif

#if PY_VERSION_HEX < 0x02060000
  #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
  #define Py_TYPE(ob)   (((PyObject*)(ob))->ob_type)
  #define Py_SIZE(ob)   (((PyVarObject*)(ob))->ob_size)
  #define PyVarObject_HEAD_INIT(type, size) \
          PyObject_HEAD_INIT(type) size,
  #define PyType_Modified(t)

  typedef struct {
     void *buf;
     PyObject *obj;
     Py_ssize_t len;
     Py_ssize_t itemsize;
     int readonly;
     int ndim;
     char *format;
     Py_ssize_t *shape;
     Py_ssize_t *strides;
     Py_ssize_t *suboffsets;
     void *internal;
  } Py_buffer;

  #define PyBUF_SIMPLE 0
  #define PyBUF_WRITABLE 0x0001
  #define PyBUF_FORMAT 0x0004
  #define PyBUF_ND 0x0008
  #define PyBUF_STRIDES (0x0010 | PyBUF_ND)
  #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES)
  #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES)
  #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES)
  #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES)
  #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE)
  #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE)

  typedef int (*getbufferproc)(PyObject *, Py_buffer *, int);
  typedef void (*releasebufferproc)(PyObject *, Py_buffer *);
#endif

#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#endif

#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6
  #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict")
#endif

#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif

#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3)
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif


#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
#else
  #define CYTHON_PEP393_ENABLED 0
  #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif

#if PY_VERSION_HEX < 0x02060000
  #define PyBytesObject                PyStringObject
  #define PyBytes_Type                 PyString_Type
  #define PyBytes_Check                PyString_Check
  #define PyBytes_CheckExact           PyString_CheckExact
  #define PyBytes_FromString           PyString_FromString
  #define PyBytes_FromStringAndSize    PyString_FromStringAndSize
  #define PyBytes_FromFormat           PyString_FromFormat
  #define PyBytes_DecodeEscape         PyString_DecodeEscape
  #define PyBytes_AsString             PyString_AsString
  #define PyBytes_AsStringAndSize      PyString_AsStringAndSize
  #define PyBytes_Size                 PyString_Size
  #define PyBytes_AS_STRING            PyString_AS_STRING
  #define PyBytes_GET_SIZE             PyString_GET_SIZE
  #define PyBytes_Repr                 PyString_Repr
  #define PyBytes_Concat               PyString_Concat
  #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
#endif

#if PY_VERSION_HEX < 0x02060000
  #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
  #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif

#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)

#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif

#if PY_VERSION_HEX < 0x03020000
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif

#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
  #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
  #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
#else
  #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
  #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
  #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
#endif

#if PY_MAJOR_VERSION >= 3
  #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#endif

#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),((char *)(n)))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),((char *)(n)))
#else
  #define __Pyx_GetAttrString(o,n)   PyObject_GetAttrString((o),(n))
  #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a))
  #define __Pyx_DelAttrString(o,n)   PyObject_DelAttrString((o),(n))
#endif

#if PY_VERSION_HEX < 0x02050000
  #define __Pyx_NAMESTR(n) ((char *)(n))
  #define __Pyx_DOCSTR(n)  ((char *)(n))
#else
  #define __Pyx_NAMESTR(n) (n)
  #define __Pyx_DOCSTR(n)  (n)
#endif

#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE__obitools__word___binary
#define __PYX_HAVE_API__obitools__word___binary
#include "math.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif


/* inline attribute */
#ifndef CYTHON_INLINE
  #if defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

/* unused attribute */
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif

typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/


/* Type Conversion Predeclarations */

#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))

#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);

static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);

#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))

#ifdef __GNUC__
  /* Test for GCC > 2.95 */
  #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
    #define likely(x)   __builtin_expect(!!(x), 1)
    #define unlikely(x) __builtin_expect(!!(x), 0)
  #else /* __GNUC__ > 2 ... */
    #define likely(x)   (x)
    #define unlikely(x) (x)
  #endif /* __GNUC__ > 2 ... */
#else /* __GNUC__ */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
    
static PyObject *__pyx_m;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "_binary.pyx",
};

/*--- Type declarations ---*/
struct __pyx_obj_8obitools_4word_7_binary_ErrorPositionIterator;
struct __pyx_obj_8obitools_4word_7_binary_WordPattern;

/* "obitools/word/_binary.pyx":222
 *     return match == all
 * 
 * cdef class ErrorPositionIterator:             # <<<<<<<<<<<<<<
 * 
 *     cdef int _wsize
 */
struct __pyx_obj_8obitools_4word_7_binary_ErrorPositionIterator {
  PyObject_HEAD
  int _wsize;
  int _errors;
  unsigned long _mask;
  int _errorpos[32];
  int _end;
};


/* "obitools/word/_binary.pyx":31
 * 
 * 
 * cdef class WordPattern :             # <<<<<<<<<<<<<<
 *     cdef public unsigned long int a
 *     cdef public unsigned long int c
 */
struct __pyx_obj_8obitools_4word_7_binary_WordPattern {
  PyObject_HEAD
  unsigned long a;
  unsigned long c;
  unsigned long g;
  unsigned long t;
};

#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
          if (acquire_gil) { \
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
              PyGILState_Release(__pyx_gilstate_save); \
          } else { \
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext() \
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif /* CYTHON_REFNANNY */
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/

static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/

static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/

static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
    const char* function_name); /*proto*/

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/

static CYTHON_INLINE int __Pyx_NegateNonNeg(int b) {
    return unlikely(b < 0) ? b : !b;
}
static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) {
    return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b);
}

#include <string.h>

static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/

static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/

#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
#else
#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
#endif

static int __Pyx_Print(PyObject*, PyObject *, int); /*proto*/
#if PY_MAJOR_VERSION >= 3
static PyObject* __pyx_print = 0;
static PyObject* __pyx_print_kwargs = 0;
#endif

static int __Pyx_PrintOne(PyObject* stream, PyObject *o); /*proto*/

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *);

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *);

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *);

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *);

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *);

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *);

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *);

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *);

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *);

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);

static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename); /*proto*/

static int __Pyx_check_binary_version(void);

typedef struct {
    int code_line;
    PyCodeObject* code_object;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);

static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename); /*proto*/

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/


/* Module declarations from 'obitools.word._binary' */
static PyTypeObject *__pyx_ptype_8obitools_4word_7_binary_WordPattern = 0;
static PyTypeObject *__pyx_ptype_8obitools_4word_7_binary_ErrorPositionIterator = 0;
static int __pyx_f_8obitools_4word_7_binary_binarywordsize(unsigned long); /*proto*/
static PyObject *__pyx_f_8obitools_4word_7_binary_bin2str(unsigned long, int __pyx_skip_dispatch); /*proto*/
static unsigned int __pyx_f_8obitools_4word_7_binary_bitCount(unsigned long); /*proto*/
static int __pyx_f_8obitools_4word_7_binary_wordDist(unsigned long, unsigned long, int __pyx_skip_dispatch); /*proto*/
static int __pyx_f_8obitools_4word_7_binary_homoMax(unsigned long, unsigned int, int __pyx_skip_dispatch); /*proto*/
static int __pyx_f_8obitools_4word_7_binary_countA(unsigned long, unsigned int, int __pyx_skip_dispatch); /*proto*/
static int __pyx_f_8obitools_4word_7_binary_countT(unsigned long, unsigned int, int __pyx_skip_dispatch); /*proto*/
static int __pyx_f_8obitools_4word_7_binary_countAT(unsigned long, unsigned int, int __pyx_skip_dispatch); /*proto*/
static int __pyx_f_8obitools_4word_7_binary_countC(unsigned long, unsigned int, int __pyx_skip_dispatch); /*proto*/
static int __pyx_f_8obitools_4word_7_binary_countG(unsigned long, unsigned int, int __pyx_skip_dispatch); /*proto*/
static int __pyx_f_8obitools_4word_7_binary_countCG(unsigned long, unsigned int, int __pyx_skip_dispatch); /*proto*/
static PyObject *__pyx_f_8obitools_4word_7_binary_decodeWord(unsigned long, unsigned int, int __pyx_skip_dispatch); /*proto*/
static int __pyx_f_8obitools_4word_7_binary_encodeWord(PyObject *, int __pyx_skip_dispatch); /*proto*/
static int __pyx_f_8obitools_4word_7_binary_matchPattern(unsigned long, PyObject *, int __pyx_skip_dispatch); /*proto*/
#define __Pyx_MODULE_NAME "obitools.word._binary"
int __pyx_module_is_main_obitools__word___binary = 0;

/* Implementation of 'obitools.word._binary' */
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_xrange;
static PyObject *__pyx_builtin_RuntimeError;
static PyObject *__pyx_builtin_StopIteration;
static PyObject *__pyx_pf_8obitools_4word_7_binary_bin2str(CYTHON_UNUSED PyObject *__pyx_self, unsigned long __pyx_v_x); /* proto */
static int __pyx_pf_8obitools_4word_7_binary_11WordPattern___init__(struct __pyx_obj_8obitools_4word_7_binary_WordPattern *__pyx_v_self, unsigned long __pyx_v_a, unsigned long __pyx_v_c, unsigned long __pyx_v_g, unsigned long __pyx_v_t); /* proto */
static PyObject *__pyx_pf_8obitools_4word_7_binary_11WordPattern_2__str__(struct __pyx_obj_8obitools_4word_7_binary_WordPattern *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8obitools_4word_7_binary_11WordPattern_1a___get__(struct __pyx_obj_8obitools_4word_7_binary_WordPattern *__pyx_v_self); /* proto */
static int __pyx_pf_8obitools_4word_7_binary_11WordPattern_1a_2__set__(struct __pyx_obj_8obitools_4word_7_binary_WordPattern *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8obitools_4word_7_binary_11WordPattern_1c___get__(struct __pyx_obj_8obitools_4word_7_binary_WordPattern *__pyx_v_self); /* proto */
static int __pyx_pf_8obitools_4word_7_binary_11WordPattern_1c_2__set__(struct __pyx_obj_8obitools_4word_7_binary_WordPattern *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8obitools_4word_7_binary_11WordPattern_1g___get__(struct __pyx_obj_8obitools_4word_7_binary_WordPattern *__pyx_v_self); /* proto */
static int __pyx_pf_8obitools_4word_7_binary_11WordPattern_1g_2__set__(struct __pyx_obj_8obitools_4word_7_binary_WordPattern *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8obitools_4word_7_binary_11WordPattern_1t___get__(struct __pyx_obj_8obitools_4word_7_binary_WordPattern *__pyx_v_self); /* proto */
static int __pyx_pf_8obitools_4word_7_binary_11WordPattern_1t_2__set__(struct __pyx_obj_8obitools_4word_7_binary_WordPattern *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
static PyObject *__pyx_pf_8obitools_4word_7_binary_2allDNAWordIterator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_size); /* proto */
static PyObject *__pyx_pf_8obitools_4word_7_binary_4wordDist(CYTHON_UNUSED PyObject *__pyx_self, unsigned long __pyx_v_w1, unsigned long __pyx_v_w2); /* proto */
static PyObject *__pyx_pf_8obitools_4word_7_binary_6homoMax(CYTHON_UNUSED PyObject *__pyx_self, unsigned long __pyx_v_word, unsigned int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_8obitools_4word_7_binary_8countA(CYTHON_UNUSED PyObject *__pyx_self, unsigned long __pyx_v_word, unsigned int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_8obitools_4word_7_binary_10countT(CYTHON_UNUSED PyObject *__pyx_self, unsigned long __pyx_v_word, unsigned int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_8obitools_4word_7_binary_12countAT(CYTHON_UNUSED PyObject *__pyx_self, unsigned long __pyx_v_word, unsigned int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_8obitools_4word_7_binary_14countC(CYTHON_UNUSED PyObject *__pyx_self, unsigned long __pyx_v_word, unsigned int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_8obitools_4word_7_binary_16countG(CYTHON_UNUSED PyObject *__pyx_self, unsigned long __pyx_v_word, unsigned int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_8obitools_4word_7_binary_18countCG(CYTHON_UNUSED PyObject *__pyx_self, unsigned long __pyx_v_word, unsigned int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_8obitools_4word_7_binary_20decodeWord(CYTHON_UNUSED PyObject *__pyx_self, unsigned long __pyx_v_word, unsigned int __pyx_v_size); /* proto */
static PyObject *__pyx_pf_8obitools_4word_7_binary_22encodeWord(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_word); /* proto */
static PyObject *__pyx_pf_8obitools_4word_7_binary_24encodePattern(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pattern); /* proto */
static PyObject *__pyx_pf_8obitools_4word_7_binary_26matchPattern(CYTHON_UNUSED PyObject *__pyx_self, unsigned long __pyx_v_word, PyObject *__pyx_v_pattern); /* proto */
static int __pyx_pf_8obitools_4word_7_binary_21ErrorPositionIterator___init__(struct __pyx_obj_8obitools_4word_7_binary_ErrorPositionIterator *__pyx_v_self, PyObject *__pyx_v_wordsize, PyObject *__pyx_v_errorcount); /* proto */
static PyObject *__pyx_pf_8obitools_4word_7_binary_21ErrorPositionIterator_2__iter__(struct __pyx_obj_8obitools_4word_7_binary_ErrorPositionIterator *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_8obitools_4word_7_binary_21ErrorPositionIterator_4next(struct __pyx_obj_8obitools_4word_7_binary_ErrorPositionIterator *__pyx_v_self); /* proto */
static char __pyx_k_1[] = "";
static char __pyx_k_2[] = "(a:%s,c:%s,g:%s,t:%s)";
static char __pyx_k_3[] = "Word length should be less or equal to 32";
static char __pyx_k_4[] = "word should only contain a, c, g or t (%s)";
static char __pyx_k_5[] = "pos %d/%d moved";
static char __pyx_k_6[] = "\nCreated on 2 juil. 2009\n\n@author: coissac\n";
static char __pyx_k_9[] = "/Users/coissac/encours/OBITools/src/obitools/word/_binary.pyx";
static char __pyx_k_10[] = "obitools.word._binary";
static char __pyx_k__0[] = "0";
static char __pyx_k__1[] = "1";
static char __pyx_k__a[] = "a";
static char __pyx_k__c[] = "c";
static char __pyx_k__g[] = "g";
static char __pyx_k__l[] = "l";
static char __pyx_k__t[] = "t";
static char __pyx_k__w1[] = "w1";
static char __pyx_k__w2[] = "w2";
static char __pyx_k__acgt[] = "acgt";
static char __pyx_k__join[] = "join";
static char __pyx_k__maxi[] = "maxi";
static char __pyx_k__size[] = "size";
static char __pyx_k__word[] = "word";
static char __pyx_k__lower[] = "lower";
static char __pyx_k__range[] = "range";
static char __pyx_k__xrange[] = "xrange";
static char __pyx_k__maxword[] = "maxword";
static char __pyx_k__pattern[] = "pattern";
static char __pyx_k____main__[] = "__main__";
static char __pyx_k____test__[] = "__test__";
static char __pyx_k__armwdhvn[] = "armwdhvn";
static char __pyx_k__cymsbhvn[] = "cymsbhvn";
static char __pyx_k__grksbdvn[] = "grksbdvn";
static char __pyx_k__tykwbdhn[] = "tykwbdhn";
static char __pyx_k__wordsize[] = "wordsize";
static char __pyx_k__errorcount[] = "errorcount";
static char __pyx_k__RuntimeError[] = "RuntimeError";
static char __pyx_k__StopIteration[] = "StopIteration";
static char __pyx_k__encodePattern[] = "encodePattern";
static char __pyx_k__allDNAWordIterator[] = "allDNAWordIterator";
static PyObject *__pyx_kp_s_1;
static PyObject *__pyx_n_s_10;
static PyObject *__pyx_kp_b_2;
static PyObject *__pyx_kp_s_3;
static PyObject *__pyx_kp_s_4;
static PyObject *__pyx_kp_s_5;
static PyObject *__pyx_kp_s_9;
static PyObject *__pyx_kp_s__0;
static PyObject *__pyx_kp_s__1;
static PyObject *__pyx_n_s__RuntimeError;
static PyObject *__pyx_n_s__StopIteration;
static PyObject *__pyx_n_s____main__;
static PyObject *__pyx_n_s____test__;
static PyObject *__pyx_n_s__a;
static PyObject *__pyx_n_s__acgt;
static PyObject *__pyx_n_s__allDNAWordIterator;
static PyObject *__pyx_n_s__armwdhvn;
static PyObject *__pyx_n_s__c;
static PyObject *__pyx_n_s__cymsbhvn;
static PyObject *__pyx_n_s__encodePattern;
static PyObject *__pyx_n_s__errorcount;
static PyObject *__pyx_n_s__g;
static PyObject *__pyx_n_s__grksbdvn;
static PyObject *__pyx_n_s__join;
static PyObject *__pyx_n_s__l;
static PyObject *__pyx_n_s__lower;
static PyObject *__pyx_n_s__maxi;
static PyObject *__pyx_n_s__maxword;
static PyObject *__pyx_n_s__pattern;
static PyObject *__pyx_n_s__range;
static PyObject *__pyx_n_s__size;
static PyObject *__pyx_n_s__t;
static PyObject *__pyx_n_s__tykwbdhn;
static PyObject *__pyx_n_s__w1;
static PyObject *__pyx_n_s__w2;
static PyObject *__pyx_n_s__word;
static PyObject *__pyx_n_s__wordsize;
static PyObject *__pyx_n_s__xrange;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_4;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_int_neg_2;
static PyObject *__pyx_int_2863311530;
static PyObject *__pyx_k_tuple_7;
static PyObject *__pyx_k_tuple_11;
static PyObject *__pyx_k_codeobj_8;
static PyObject *__pyx_k_codeobj_12;

/* "obitools/word/_binary.pyx":14
 *     double log(double x)
 * 
 * cdef int binarywordsize(unsigned long int x):             # <<<<<<<<<<<<<<
 *     return <int>ceil(log(x)/log(2))
 * 
 */

static int __pyx_f_8obitools_4word_7_binary_binarywordsize(unsigned long __pyx_v_x) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  double __pyx_t_1;
  double __pyx_t_2;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("binarywordsize", 0);

  /* "obitools/word/_binary.pyx":15
 * 
 * cdef int binarywordsize(unsigned long int x):
 *     return <int>ceil(log(x)/log(2))             # <<<<<<<<<<<<<<
 * 
 * cpdef str bin2str(unsigned long int x):
 */
  __pyx_t_1 = log(__pyx_v_x);
  __pyx_t_2 = log(2.0);
  if (unlikely(__pyx_t_2 == 0)) {
    PyErr_Format(PyExc_ZeroDivisionError, "float division");
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_r = ((int)ceil((__pyx_t_1 / __pyx_t_2)));
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_WriteUnraisable("obitools.word._binary.binarywordsize", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":17
 *     return <int>ceil(log(x)/log(2))
 * 
 * cpdef str bin2str(unsigned long int x):             # <<<<<<<<<<<<<<
 *     cdef str rep=''
 *     cdef unsigned long int i
 */

static PyObject *__pyx_pw_8obitools_4word_7_binary_1bin2str(PyObject *__pyx_self, PyObject *__pyx_arg_x); /*proto*/
static PyObject *__pyx_f_8obitools_4word_7_binary_bin2str(unsigned long __pyx_v_x, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_v_rep = 0;
  unsigned long __pyx_v_i;
  int __pyx_v_ws;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  unsigned long __pyx_t_2;
  unsigned long __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bin2str", 0);

  /* "obitools/word/_binary.pyx":18
 * 
 * cpdef str bin2str(unsigned long int x):
 *     cdef str rep=''             # <<<<<<<<<<<<<<
 *     cdef unsigned long int i
 *     cdef int ws = binarywordsize(x)
 */
  __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
  __pyx_v_rep = __pyx_kp_s_1;

  /* "obitools/word/_binary.pyx":20
 *     cdef str rep=''
 *     cdef unsigned long int i
 *     cdef int ws = binarywordsize(x)             # <<<<<<<<<<<<<<
 * 
 *     for i in range(ws):
 */
  __pyx_v_ws = __pyx_f_8obitools_4word_7_binary_binarywordsize(__pyx_v_x);

  /* "obitools/word/_binary.pyx":22
 *     cdef int ws = binarywordsize(x)
 * 
 *     for i in range(ws):             # <<<<<<<<<<<<<<
 *         if x & (1 << i):
 *             rep = '1' + rep
 */
  __pyx_t_1 = __pyx_v_ws;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "obitools/word/_binary.pyx":23
 * 
 *     for i in range(ws):
 *         if x & (1 << i):             # <<<<<<<<<<<<<<
 *             rep = '1' + rep
 *         else:
 */
    __pyx_t_3 = (__pyx_v_x & (1 << __pyx_v_i));
    if (__pyx_t_3) {

      /* "obitools/word/_binary.pyx":24
 *     for i in range(ws):
 *         if x & (1 << i):
 *             rep = '1' + rep             # <<<<<<<<<<<<<<
 *         else:
 *             rep = '0' + rep
 */
      __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_kp_s__1), ((PyObject *)__pyx_v_rep)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_DECREF(((PyObject *)__pyx_v_rep));
      __pyx_v_rep = __pyx_t_4;
      __pyx_t_4 = 0;
      goto __pyx_L5;
    }
    /*else*/ {

      /* "obitools/word/_binary.pyx":26
 *             rep = '1' + rep
 *         else:
 *             rep = '0' + rep             # <<<<<<<<<<<<<<
 *     return rep
 * 
 */
      __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_kp_s__0), ((PyObject *)__pyx_v_rep)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_4));
      __Pyx_DECREF(((PyObject *)__pyx_v_rep));
      __pyx_v_rep = __pyx_t_4;
      __pyx_t_4 = 0;
    }
    __pyx_L5:;
  }

  /* "obitools/word/_binary.pyx":27
 *         else:
 *             rep = '0' + rep
 *     return rep             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __Pyx_INCREF(((PyObject *)__pyx_v_rep));
  __pyx_r = __pyx_v_rep;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("obitools.word._binary.bin2str", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_rep);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8obitools_4word_7_binary_1bin2str(PyObject *__pyx_self, PyObject *__pyx_arg_x); /*proto*/
static PyObject *__pyx_pw_8obitools_4word_7_binary_1bin2str(PyObject *__pyx_self, PyObject *__pyx_arg_x) {
  unsigned long __pyx_v_x;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bin2str (wrapper)", 0);
  __pyx_self = __pyx_self;
  assert(__pyx_arg_x); {
    __pyx_v_x = __Pyx_PyInt_AsUnsignedLong(__pyx_arg_x); if (unlikely((__pyx_v_x == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L3_error:;
  __Pyx_AddTraceback("obitools.word._binary.bin2str", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_bin2str(__pyx_self, ((unsigned long)__pyx_v_x));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":17
 *     return <int>ceil(log(x)/log(2))
 * 
 * cpdef str bin2str(unsigned long int x):             # <<<<<<<<<<<<<<
 *     cdef str rep=''
 *     cdef unsigned long int i
 */

static PyObject *__pyx_pf_8obitools_4word_7_binary_bin2str(CYTHON_UNUSED PyObject *__pyx_self, unsigned long __pyx_v_x) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("bin2str", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_8obitools_4word_7_binary_bin2str(__pyx_v_x, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("obitools.word._binary.bin2str", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8obitools_4word_7_binary_11WordPattern_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8obitools_4word_7_binary_11WordPattern_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned long __pyx_v_a;
  unsigned long __pyx_v_c;
  unsigned long __pyx_v_g;
  unsigned long __pyx_v_t;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__a,&__pyx_n_s__c,&__pyx_n_s__g,&__pyx_n_s__t,0};
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__c);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__g);
        if (likely(values[2])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__t);
        if (likely(values[3])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_a = __Pyx_PyInt_AsUnsignedLong(values[0]); if (unlikely((__pyx_v_a == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_c = __Pyx_PyInt_AsUnsignedLong(values[1]); if (unlikely((__pyx_v_c == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_g = __Pyx_PyInt_AsUnsignedLong(values[2]); if (unlikely((__pyx_v_g == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_t = __Pyx_PyInt_AsUnsignedLong(values[3]); if (unlikely((__pyx_v_t == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("obitools.word._binary.WordPattern.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_11WordPattern___init__(((struct __pyx_obj_8obitools_4word_7_binary_WordPattern *)__pyx_v_self), __pyx_v_a, __pyx_v_c, __pyx_v_g, __pyx_v_t);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":38
 * 
 * 
 *     def __init__(self, unsigned long int a,             # <<<<<<<<<<<<<<
 *                        unsigned long int c,
 *                        unsigned long int g,
 */

static int __pyx_pf_8obitools_4word_7_binary_11WordPattern___init__(struct __pyx_obj_8obitools_4word_7_binary_WordPattern *__pyx_v_self, unsigned long __pyx_v_a, unsigned long __pyx_v_c, unsigned long __pyx_v_g, unsigned long __pyx_v_t) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "obitools/word/_binary.pyx":42
 *                        unsigned long int g,
 *                        unsigned long int t):
 *         self.a=a             # <<<<<<<<<<<<<<
 *         self.c=c
 *         self.g=g
 */
  __pyx_v_self->a = __pyx_v_a;

  /* "obitools/word/_binary.pyx":43
 *                        unsigned long int t):
 *         self.a=a
 *         self.c=c             # <<<<<<<<<<<<<<
 *         self.g=g
 *         self.t=t
 */
  __pyx_v_self->c = __pyx_v_c;

  /* "obitools/word/_binary.pyx":44
 *         self.a=a
 *         self.c=c
 *         self.g=g             # <<<<<<<<<<<<<<
 *         self.t=t
 * 
 */
  __pyx_v_self->g = __pyx_v_g;

  /* "obitools/word/_binary.pyx":45
 *         self.c=c
 *         self.g=g
 *         self.t=t             # <<<<<<<<<<<<<<
 * 
 *     def __str__(self):
 */
  __pyx_v_self->t = __pyx_v_t;

  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8obitools_4word_7_binary_11WordPattern_3__str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8obitools_4word_7_binary_11WordPattern_3__str__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__str__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_11WordPattern_2__str__(((struct __pyx_obj_8obitools_4word_7_binary_WordPattern *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":47
 *         self.t=t
 * 
 *     def __str__(self):             # <<<<<<<<<<<<<<
 *         return b"(a:%s,c:%s,g:%s,t:%s)" % (bin2str(self.a),
 *                                            bin2str(self.c),
 */

static PyObject *__pyx_pf_8obitools_4word_7_binary_11WordPattern_2__str__(struct __pyx_obj_8obitools_4word_7_binary_WordPattern *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__str__", 0);

  /* "obitools/word/_binary.pyx":48
 * 
 *     def __str__(self):
 *         return b"(a:%s,c:%s,g:%s,t:%s)" % (bin2str(self.a),             # <<<<<<<<<<<<<<
 *                                            bin2str(self.c),
 *                                            bin2str(self.g),
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_8obitools_4word_7_binary_bin2str(__pyx_v_self->a, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "obitools/word/_binary.pyx":49
 *     def __str__(self):
 *         return b"(a:%s,c:%s,g:%s,t:%s)" % (bin2str(self.a),
 *                                            bin2str(self.c),             # <<<<<<<<<<<<<<
 *                                            bin2str(self.g),
 *                                            bin2str(self.t))
 */
  __pyx_t_2 = ((PyObject *)__pyx_f_8obitools_4word_7_binary_bin2str(__pyx_v_self->c, 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);

  /* "obitools/word/_binary.pyx":50
 *         return b"(a:%s,c:%s,g:%s,t:%s)" % (bin2str(self.a),
 *                                            bin2str(self.c),
 *                                            bin2str(self.g),             # <<<<<<<<<<<<<<
 *                                            bin2str(self.t))
 * 
 */
  __pyx_t_3 = ((PyObject *)__pyx_f_8obitools_4word_7_binary_bin2str(__pyx_v_self->g, 0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);

  /* "obitools/word/_binary.pyx":51
 *                                            bin2str(self.c),
 *                                            bin2str(self.g),
 *                                            bin2str(self.t))             # <<<<<<<<<<<<<<
 * 
 * cdef unsigned int bitCount(unsigned long int x):
 */
  __pyx_t_4 = ((PyObject *)__pyx_f_8obitools_4word_7_binary_bin2str(__pyx_v_self->t, 0)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_b_2), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
  __pyx_r = __pyx_t_4;
  __pyx_t_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("obitools.word._binary.WordPattern.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8obitools_4word_7_binary_11WordPattern_1a_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8obitools_4word_7_binary_11WordPattern_1a_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_11WordPattern_1a___get__(((struct __pyx_obj_8obitools_4word_7_binary_WordPattern *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":32
 * 
 * cdef class WordPattern :
 *     cdef public unsigned long int a             # <<<<<<<<<<<<<<
 *     cdef public unsigned long int c
 *     cdef public unsigned long int g
 */

static PyObject *__pyx_pf_8obitools_4word_7_binary_11WordPattern_1a___get__(struct __pyx_obj_8obitools_4word_7_binary_WordPattern *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_self->a); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("obitools.word._binary.WordPattern.a.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8obitools_4word_7_binary_11WordPattern_1a_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8obitools_4word_7_binary_11WordPattern_1a_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_11WordPattern_1a_2__set__(((struct __pyx_obj_8obitools_4word_7_binary_WordPattern *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8obitools_4word_7_binary_11WordPattern_1a_2__set__(struct __pyx_obj_8obitools_4word_7_binary_WordPattern *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  unsigned long __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->a = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("obitools.word._binary.WordPattern.a.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8obitools_4word_7_binary_11WordPattern_1c_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8obitools_4word_7_binary_11WordPattern_1c_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_11WordPattern_1c___get__(((struct __pyx_obj_8obitools_4word_7_binary_WordPattern *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":33
 * cdef class WordPattern :
 *     cdef public unsigned long int a
 *     cdef public unsigned long int c             # <<<<<<<<<<<<<<
 *     cdef public unsigned long int g
 *     cdef public unsigned long int t
 */

static PyObject *__pyx_pf_8obitools_4word_7_binary_11WordPattern_1c___get__(struct __pyx_obj_8obitools_4word_7_binary_WordPattern *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_self->c); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("obitools.word._binary.WordPattern.c.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8obitools_4word_7_binary_11WordPattern_1c_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8obitools_4word_7_binary_11WordPattern_1c_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_11WordPattern_1c_2__set__(((struct __pyx_obj_8obitools_4word_7_binary_WordPattern *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8obitools_4word_7_binary_11WordPattern_1c_2__set__(struct __pyx_obj_8obitools_4word_7_binary_WordPattern *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  unsigned long __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->c = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("obitools.word._binary.WordPattern.c.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8obitools_4word_7_binary_11WordPattern_1g_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8obitools_4word_7_binary_11WordPattern_1g_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_11WordPattern_1g___get__(((struct __pyx_obj_8obitools_4word_7_binary_WordPattern *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":34
 *     cdef public unsigned long int a
 *     cdef public unsigned long int c
 *     cdef public unsigned long int g             # <<<<<<<<<<<<<<
 *     cdef public unsigned long int t
 * 
 */

static PyObject *__pyx_pf_8obitools_4word_7_binary_11WordPattern_1g___get__(struct __pyx_obj_8obitools_4word_7_binary_WordPattern *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_self->g); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("obitools.word._binary.WordPattern.g.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8obitools_4word_7_binary_11WordPattern_1g_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8obitools_4word_7_binary_11WordPattern_1g_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_11WordPattern_1g_2__set__(((struct __pyx_obj_8obitools_4word_7_binary_WordPattern *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8obitools_4word_7_binary_11WordPattern_1g_2__set__(struct __pyx_obj_8obitools_4word_7_binary_WordPattern *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  unsigned long __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->g = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("obitools.word._binary.WordPattern.g.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8obitools_4word_7_binary_11WordPattern_1t_1__get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8obitools_4word_7_binary_11WordPattern_1t_1__get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_11WordPattern_1t___get__(((struct __pyx_obj_8obitools_4word_7_binary_WordPattern *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":35
 *     cdef public unsigned long int c
 *     cdef public unsigned long int g
 *     cdef public unsigned long int t             # <<<<<<<<<<<<<<
 * 
 * 
 */

static PyObject *__pyx_pf_8obitools_4word_7_binary_11WordPattern_1t___get__(struct __pyx_obj_8obitools_4word_7_binary_WordPattern *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__get__", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_self->t); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("obitools.word._binary.WordPattern.t.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8obitools_4word_7_binary_11WordPattern_1t_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
static int __pyx_pw_8obitools_4word_7_binary_11WordPattern_1t_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_11WordPattern_1t_2__set__(((struct __pyx_obj_8obitools_4word_7_binary_WordPattern *)__pyx_v_self), ((PyObject *)__pyx_v_value));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_8obitools_4word_7_binary_11WordPattern_1t_2__set__(struct __pyx_obj_8obitools_4word_7_binary_WordPattern *__pyx_v_self, PyObject *__pyx_v_value) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  unsigned long __pyx_t_1;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__set__", 0);
  __pyx_t_1 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_value); if (unlikely((__pyx_t_1 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->t = __pyx_t_1;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("obitools.word._binary.WordPattern.t.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":53
 *                                            bin2str(self.t))
 * 
 * cdef unsigned int bitCount(unsigned long int x):             # <<<<<<<<<<<<<<
 *     cdef unsigned int i=0
 *     while(x):
 */

static unsigned int __pyx_f_8obitools_4word_7_binary_bitCount(unsigned long __pyx_v_x) {
  unsigned int __pyx_v_i;
  unsigned int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("bitCount", 0);

  /* "obitools/word/_binary.pyx":54
 * 
 * cdef unsigned int bitCount(unsigned long int x):
 *     cdef unsigned int i=0             # <<<<<<<<<<<<<<
 *     while(x):
 *         i+=1
 */
  __pyx_v_i = 0;

  /* "obitools/word/_binary.pyx":55
 * cdef unsigned int bitCount(unsigned long int x):
 *     cdef unsigned int i=0
 *     while(x):             # <<<<<<<<<<<<<<
 *         i+=1
 *         x&=x-1
 */
  while (1) {
    if (!__pyx_v_x) break;

    /* "obitools/word/_binary.pyx":56
 *     cdef unsigned int i=0
 *     while(x):
 *         i+=1             # <<<<<<<<<<<<<<
 *         x&=x-1
 *     return i
 */
    __pyx_v_i = (__pyx_v_i + 1);

    /* "obitools/word/_binary.pyx":57
 *     while(x):
 *         i+=1
 *         x&=x-1             # <<<<<<<<<<<<<<
 *     return i
 * 
 */
    __pyx_v_x = (__pyx_v_x & (__pyx_v_x - 1));
  }

  /* "obitools/word/_binary.pyx":58
 *         i+=1
 *         x&=x-1
 *     return i             # <<<<<<<<<<<<<<
 * 
 * def allDNAWordIterator(size):
 */
  __pyx_r = __pyx_v_i;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8obitools_4word_7_binary_3allDNAWordIterator(PyObject *__pyx_self, PyObject *__pyx_v_size); /*proto*/
static char __pyx_doc_8obitools_4word_7_binary_2allDNAWordIterator[] = "\n    Iterate thought the list of all DNA word of\n    size `size`.\n    \n    @param size: size of the DNA word\n    @type size: int\n    \n    @return: an iterator on DNA word (int)\n    @rtype: iterator\n    ";
static PyMethodDef __pyx_mdef_8obitools_4word_7_binary_3allDNAWordIterator = {__Pyx_NAMESTR("allDNAWordIterator"), (PyCFunction)__pyx_pw_8obitools_4word_7_binary_3allDNAWordIterator, METH_O, __Pyx_DOCSTR(__pyx_doc_8obitools_4word_7_binary_2allDNAWordIterator)};
static PyObject *__pyx_pw_8obitools_4word_7_binary_3allDNAWordIterator(PyObject *__pyx_self, PyObject *__pyx_v_size) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("allDNAWordIterator (wrapper)", 0);
  __pyx_self = __pyx_self;
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_2allDNAWordIterator(__pyx_self, ((PyObject *)__pyx_v_size));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":60
 *     return i
 * 
 * def allDNAWordIterator(size):             # <<<<<<<<<<<<<<
 *     '''
 *     Iterate thought the list of all DNA word of
 */

static PyObject *__pyx_pf_8obitools_4word_7_binary_2allDNAWordIterator(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_size) {
  PyObject *__pyx_v_maxi = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("allDNAWordIterator", 0);

  /* "obitools/word/_binary.pyx":72
 *     '''
 * 
 *     maxi=4**size             # <<<<<<<<<<<<<<
 *     return xrange(maxi)
 * 
 */
  __pyx_t_1 = PyNumber_Power(__pyx_int_4, __pyx_v_size, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_maxi = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "obitools/word/_binary.pyx":73
 * 
 *     maxi=4**size
 *     return xrange(maxi)             # <<<<<<<<<<<<<<
 * 
 * cpdef int wordDist(unsigned long int w1,unsigned long int w2):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_maxi);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_maxi);
  __Pyx_GIVEREF(__pyx_v_maxi);
  __pyx_t_2 = PyObject_Call(__pyx_builtin_xrange, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("obitools.word._binary.allDNAWordIterator", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_maxi);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":75
 *     return xrange(maxi)
 * 
 * cpdef int wordDist(unsigned long int w1,unsigned long int w2):             # <<<<<<<<<<<<<<
 *     '''
 *     estimate Hamming distance between two words of the same size.
 */

static PyObject *__pyx_pw_8obitools_4word_7_binary_5wordDist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_8obitools_4word_7_binary_wordDist(unsigned long __pyx_v_w1, unsigned long __pyx_v_w2, CYTHON_UNUSED int __pyx_skip_dispatch) {
  unsigned long __pyx_v_diff;
  unsigned long __pyx_v_dist;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("wordDist", 0);

  /* "obitools/word/_binary.pyx":90
 *     cdef unsigned long int dist
 * 
 *     diff = (~(w1 & w2) & (w1 | w2))             # <<<<<<<<<<<<<<
 *     diff = (diff | (diff >> 1)) & 0x55555555
 *     dist = bitCount(diff)
 */
  __pyx_v_diff = ((~(__pyx_v_w1 & __pyx_v_w2)) & (__pyx_v_w1 | __pyx_v_w2));

  /* "obitools/word/_binary.pyx":91
 * 
 *     diff = (~(w1 & w2) & (w1 | w2))
 *     diff = (diff | (diff >> 1)) & 0x55555555             # <<<<<<<<<<<<<<
 *     dist = bitCount(diff)
 *     return dist
 */
  __pyx_v_diff = ((__pyx_v_diff | (__pyx_v_diff >> 1)) & 0x55555555);

  /* "obitools/word/_binary.pyx":92
 *     diff = (~(w1 & w2) & (w1 | w2))
 *     diff = (diff | (diff >> 1)) & 0x55555555
 *     dist = bitCount(diff)             # <<<<<<<<<<<<<<
 *     return dist
 * 
 */
  __pyx_v_dist = __pyx_f_8obitools_4word_7_binary_bitCount(__pyx_v_diff);

  /* "obitools/word/_binary.pyx":93
 *     diff = (diff | (diff >> 1)) & 0x55555555
 *     dist = bitCount(diff)
 *     return dist             # <<<<<<<<<<<<<<
 * 
 * cpdef int homoMax(unsigned long int word,unsigned int size):
 */
  __pyx_r = __pyx_v_dist;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8obitools_4word_7_binary_5wordDist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_8obitools_4word_7_binary_4wordDist[] = "\n    estimate Hamming distance between two words of the same size.\n    \n    @param w1: the first word\n    @type w1:  str\n    @param w2: the second word\n    @type w2:  str\n    \n    @return: the count of difference between the two words\n    @rtype: int\n    ";
static PyObject *__pyx_pw_8obitools_4word_7_binary_5wordDist(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned long __pyx_v_w1;
  unsigned long __pyx_v_w2;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__w1,&__pyx_n_s__w2,0};
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("wordDist (wrapper)", 0);
  __pyx_self = __pyx_self;
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__w1);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__w2);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("wordDist", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "wordDist") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_w1 = __Pyx_PyInt_AsUnsignedLong(values[0]); if (unlikely((__pyx_v_w1 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_w2 = __Pyx_PyInt_AsUnsignedLong(values[1]); if (unlikely((__pyx_v_w2 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("wordDist", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("obitools.word._binary.wordDist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_4wordDist(__pyx_self, __pyx_v_w1, __pyx_v_w2);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":75
 *     return xrange(maxi)
 * 
 * cpdef int wordDist(unsigned long int w1,unsigned long int w2):             # <<<<<<<<<<<<<<
 *     '''
 *     estimate Hamming distance between two words of the same size.
 */

static PyObject *__pyx_pf_8obitools_4word_7_binary_4wordDist(CYTHON_UNUSED PyObject *__pyx_self, unsigned long __pyx_v_w1, unsigned long __pyx_v_w2) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("wordDist", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_f_8obitools_4word_7_binary_wordDist(__pyx_v_w1, __pyx_v_w2, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("obitools.word._binary.wordDist", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":95
 *     return dist
 * 
 * cpdef int homoMax(unsigned long int word,unsigned int size):             # <<<<<<<<<<<<<<
 *     cdef unsigned long int mask
 *     cdef unsigned long int good
 */

static PyObject *__pyx_pw_8obitools_4word_7_binary_7homoMax(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_8obitools_4word_7_binary_homoMax(unsigned long __pyx_v_word, unsigned int __pyx_v_size, CYTHON_UNUSED int __pyx_skip_dispatch) {
  unsigned long __pyx_v_mask;
  unsigned long __pyx_v_good;
  unsigned long __pyx_v_maxi;
  unsigned long __pyx_v_shift;
  PyObject *__pyx_v_id = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  unsigned long __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("homoMax", 0);

  /* "obitools/word/_binary.pyx":101
 *     cdef unsigned long int shift
 * 
 *     mask = (1 << (size << 1))-1             # <<<<<<<<<<<<<<
 *     good = 0x55555555
 *     maxi=0
 */
  __pyx_v_mask = ((1 << (__pyx_v_size << 1)) - 1);

  /* "obitools/word/_binary.pyx":102
 * 
 *     mask = (1 << (size << 1))-1
 *     good = 0x55555555             # <<<<<<<<<<<<<<
 *     maxi=0
 *     shift = word
 */
  __pyx_v_good = 0x55555555;

  /* "obitools/word/_binary.pyx":103
 *     mask = (1 << (size << 1))-1
 *     good = 0x55555555
 *     maxi=0             # <<<<<<<<<<<<<<
 *     shift = word
 *     while good:
 */
  __pyx_v_maxi = 0;

  /* "obitools/word/_binary.pyx":104
 *     good = 0x55555555
 *     maxi=0
 *     shift = word             # <<<<<<<<<<<<<<
 *     while good:
 *         maxi+=1
 */
  __pyx_v_shift = __pyx_v_word;

  /* "obitools/word/_binary.pyx":105
 *     maxi=0
 *     shift = word
 *     while good:             # <<<<<<<<<<<<<<
 *         maxi+=1
 *         shift>>=2
 */
  while (1) {
    if (!__pyx_v_good) break;

    /* "obitools/word/_binary.pyx":106
 *     shift = word
 *     while good:
 *         maxi+=1             # <<<<<<<<<<<<<<
 *         shift>>=2
 *         mask>>=2
 */
    __pyx_v_maxi = (__pyx_v_maxi + 1);

    /* "obitools/word/_binary.pyx":107
 *     while good:
 *         maxi+=1
 *         shift>>=2             # <<<<<<<<<<<<<<
 *         mask>>=2
 *         id = (word & shift) | (~word & ~shift)
 */
    __pyx_v_shift = (__pyx_v_shift >> 2);

    /* "obitools/word/_binary.pyx":108
 *         maxi+=1
 *         shift>>=2
 *         mask>>=2             # <<<<<<<<<<<<<<
 *         id = (word & shift) | (~word & ~shift)
 *         good&= id & (id>>1) & mask
 */
    __pyx_v_mask = (__pyx_v_mask >> 2);

    /* "obitools/word/_binary.pyx":109
 *         shift>>=2
 *         mask>>=2
 *         id = (word & shift) | (~word & ~shift)             # <<<<<<<<<<<<<<
 *         good&= id & (id>>1) & mask
 *     return maxi
 */
    __pyx_t_1 = PyLong_FromUnsignedLong(((__pyx_v_word & __pyx_v_shift) | ((~__pyx_v_word) & (~__pyx_v_shift)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF(__pyx_v_id);
    __pyx_v_id = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "obitools/word/_binary.pyx":110
 *         mask>>=2
 *         id = (word & shift) | (~word & ~shift)
 *         good&= id & (id>>1) & mask             # <<<<<<<<<<<<<<
 *     return maxi
 * 
 */
    __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_good); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = PyNumber_Rshift(__pyx_v_id, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyNumber_And(__pyx_v_id, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_mask); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyNumber_And(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_InPlaceAnd(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_5 = __Pyx_PyInt_AsUnsignedLong(__pyx_t_2); if (unlikely((__pyx_t_5 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_v_good = __pyx_t_5;
  }

  /* "obitools/word/_binary.pyx":111
 *         id = (word & shift) | (~word & ~shift)
 *         good&= id & (id>>1) & mask
 *     return maxi             # <<<<<<<<<<<<<<
 * 
 * cpdef int countA(unsigned long int word,unsigned int size):
 */
  __pyx_r = __pyx_v_maxi;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_WriteUnraisable("obitools.word._binary.homoMax", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_id);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8obitools_4word_7_binary_7homoMax(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8obitools_4word_7_binary_7homoMax(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned long __pyx_v_word;
  unsigned int __pyx_v_size;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__word,&__pyx_n_s__size,0};
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("homoMax (wrapper)", 0);
  __pyx_self = __pyx_self;
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__word);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("homoMax", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "homoMax") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_word = __Pyx_PyInt_AsUnsignedLong(values[0]); if (unlikely((__pyx_v_word == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_size = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_size == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("homoMax", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("obitools.word._binary.homoMax", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_6homoMax(__pyx_self, __pyx_v_word, __pyx_v_size);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":95
 *     return dist
 * 
 * cpdef int homoMax(unsigned long int word,unsigned int size):             # <<<<<<<<<<<<<<
 *     cdef unsigned long int mask
 *     cdef unsigned long int good
 */

static PyObject *__pyx_pf_8obitools_4word_7_binary_6homoMax(CYTHON_UNUSED PyObject *__pyx_self, unsigned long __pyx_v_word, unsigned int __pyx_v_size) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("homoMax", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_f_8obitools_4word_7_binary_homoMax(__pyx_v_word, __pyx_v_size, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("obitools.word._binary.homoMax", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":113
 *     return maxi
 * 
 * cpdef int countA(unsigned long int word,unsigned int size):             # <<<<<<<<<<<<<<
 *     cdef unsigned long int mask
 *     cdef unsigned long int id
 */

static PyObject *__pyx_pw_8obitools_4word_7_binary_9countA(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_8obitools_4word_7_binary_countA(unsigned long __pyx_v_word, unsigned int __pyx_v_size, CYTHON_UNUSED int __pyx_skip_dispatch) {
  unsigned long __pyx_v_mask;
  unsigned long __pyx_v_id;
  unsigned long __pyx_v_good;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("countA", 0);

  /* "obitools/word/_binary.pyx":117
 *     cdef unsigned long int id
 *     cdef unsigned long int good
 *     mask = (1 << (size << 1))-1             # <<<<<<<<<<<<<<
 *     id = ~word
 *     good= id & (id>>1) & 0x55555555 & mask
 */
  __pyx_v_mask = ((1 << (__pyx_v_size << 1)) - 1);

  /* "obitools/word/_binary.pyx":118
 *     cdef unsigned long int good
 *     mask = (1 << (size << 1))-1
 *     id = ~word             # <<<<<<<<<<<<<<
 *     good= id & (id>>1) & 0x55555555 & mask
 *     return bitCount(good)
 */
  __pyx_v_id = (~__pyx_v_word);

  /* "obitools/word/_binary.pyx":119
 *     mask = (1 << (size << 1))-1
 *     id = ~word
 *     good= id & (id>>1) & 0x55555555 & mask             # <<<<<<<<<<<<<<
 *     return bitCount(good)
 * 
 */
  __pyx_v_good = (((__pyx_v_id & (__pyx_v_id >> 1)) & 0x55555555) & __pyx_v_mask);

  /* "obitools/word/_binary.pyx":120
 *     id = ~word
 *     good= id & (id>>1) & 0x55555555 & mask
 *     return bitCount(good)             # <<<<<<<<<<<<<<
 * 
 * cpdef int countT(unsigned long int word,unsigned int size):
 */
  __pyx_r = __pyx_f_8obitools_4word_7_binary_bitCount(__pyx_v_good);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8obitools_4word_7_binary_9countA(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8obitools_4word_7_binary_9countA(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned long __pyx_v_word;
  unsigned int __pyx_v_size;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__word,&__pyx_n_s__size,0};
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("countA (wrapper)", 0);
  __pyx_self = __pyx_self;
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__word);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("countA", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "countA") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_word = __Pyx_PyInt_AsUnsignedLong(values[0]); if (unlikely((__pyx_v_word == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_size = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_size == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("countA", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("obitools.word._binary.countA", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_8countA(__pyx_self, __pyx_v_word, __pyx_v_size);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":113
 *     return maxi
 * 
 * cpdef int countA(unsigned long int word,unsigned int size):             # <<<<<<<<<<<<<<
 *     cdef unsigned long int mask
 *     cdef unsigned long int id
 */

static PyObject *__pyx_pf_8obitools_4word_7_binary_8countA(CYTHON_UNUSED PyObject *__pyx_self, unsigned long __pyx_v_word, unsigned int __pyx_v_size) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("countA", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_f_8obitools_4word_7_binary_countA(__pyx_v_word, __pyx_v_size, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("obitools.word._binary.countA", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":122
 *     return bitCount(good)
 * 
 * cpdef int countT(unsigned long int word,unsigned int size):             # <<<<<<<<<<<<<<
 *     cdef unsigned long int good
 * 
 */

static PyObject *__pyx_pw_8obitools_4word_7_binary_11countT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_8obitools_4word_7_binary_countT(unsigned long __pyx_v_word, CYTHON_UNUSED unsigned int __pyx_v_size, CYTHON_UNUSED int __pyx_skip_dispatch) {
  unsigned long __pyx_v_good;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("countT", 0);

  /* "obitools/word/_binary.pyx":125
 *     cdef unsigned long int good
 * 
 *     good= word & (word>>1) & 0x55555555             # <<<<<<<<<<<<<<
 *     return bitCount(good)
 * 
 */
  __pyx_v_good = ((__pyx_v_word & (__pyx_v_word >> 1)) & 0x55555555);

  /* "obitools/word/_binary.pyx":126
 * 
 *     good= word & (word>>1) & 0x55555555
 *     return bitCount(good)             # <<<<<<<<<<<<<<
 * 
 * cpdef int countAT(unsigned long int word,unsigned int size):
 */
  __pyx_r = __pyx_f_8obitools_4word_7_binary_bitCount(__pyx_v_good);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8obitools_4word_7_binary_11countT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8obitools_4word_7_binary_11countT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned long __pyx_v_word;
  unsigned int __pyx_v_size;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__word,&__pyx_n_s__size,0};
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("countT (wrapper)", 0);
  __pyx_self = __pyx_self;
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__word);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("countT", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "countT") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_word = __Pyx_PyInt_AsUnsignedLong(values[0]); if (unlikely((__pyx_v_word == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_size = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_size == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("countT", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("obitools.word._binary.countT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_10countT(__pyx_self, __pyx_v_word, __pyx_v_size);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":122
 *     return bitCount(good)
 * 
 * cpdef int countT(unsigned long int word,unsigned int size):             # <<<<<<<<<<<<<<
 *     cdef unsigned long int good
 * 
 */

static PyObject *__pyx_pf_8obitools_4word_7_binary_10countT(CYTHON_UNUSED PyObject *__pyx_self, unsigned long __pyx_v_word, unsigned int __pyx_v_size) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("countT", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_f_8obitools_4word_7_binary_countT(__pyx_v_word, __pyx_v_size, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("obitools.word._binary.countT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":128
 *     return bitCount(good)
 * 
 * cpdef int countAT(unsigned long int word,unsigned int size):             # <<<<<<<<<<<<<<
 *     cdef unsigned long int mask
 *     cdef unsigned long int shift
 */

static PyObject *__pyx_pw_8obitools_4word_7_binary_13countAT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_8obitools_4word_7_binary_countAT(unsigned long __pyx_v_word, unsigned int __pyx_v_size, CYTHON_UNUSED int __pyx_skip_dispatch) {
  unsigned long __pyx_v_mask;
  unsigned long __pyx_v_shift;
  unsigned long __pyx_v_good;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("countAT", 0);

  /* "obitools/word/_binary.pyx":133
 *     cdef unsigned long int good
 * 
 *     mask = (1 << (size << 1))-1             # <<<<<<<<<<<<<<
 *     shift = word >> 1
 *     good  = ((word & shift) | (~word & ~shift)) & 0x55555555 & mask
 */
  __pyx_v_mask = ((1 << (__pyx_v_size << 1)) - 1);

  /* "obitools/word/_binary.pyx":134
 * 
 *     mask = (1 << (size << 1))-1
 *     shift = word >> 1             # <<<<<<<<<<<<<<
 *     good  = ((word & shift) | (~word & ~shift)) & 0x55555555 & mask
 *     return bitCount(good)
 */
  __pyx_v_shift = (__pyx_v_word >> 1);

  /* "obitools/word/_binary.pyx":135
 *     mask = (1 << (size << 1))-1
 *     shift = word >> 1
 *     good  = ((word & shift) | (~word & ~shift)) & 0x55555555 & mask             # <<<<<<<<<<<<<<
 *     return bitCount(good)
 * 
 */
  __pyx_v_good = ((((__pyx_v_word & __pyx_v_shift) | ((~__pyx_v_word) & (~__pyx_v_shift))) & 0x55555555) & __pyx_v_mask);

  /* "obitools/word/_binary.pyx":136
 *     shift = word >> 1
 *     good  = ((word & shift) | (~word & ~shift)) & 0x55555555 & mask
 *     return bitCount(good)             # <<<<<<<<<<<<<<
 * 
 * cpdef int countC(unsigned long int word,unsigned int size):
 */
  __pyx_r = __pyx_f_8obitools_4word_7_binary_bitCount(__pyx_v_good);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8obitools_4word_7_binary_13countAT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8obitools_4word_7_binary_13countAT(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned long __pyx_v_word;
  unsigned int __pyx_v_size;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__word,&__pyx_n_s__size,0};
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("countAT (wrapper)", 0);
  __pyx_self = __pyx_self;
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__word);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("countAT", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "countAT") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_word = __Pyx_PyInt_AsUnsignedLong(values[0]); if (unlikely((__pyx_v_word == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_size = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_size == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("countAT", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("obitools.word._binary.countAT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_12countAT(__pyx_self, __pyx_v_word, __pyx_v_size);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":128
 *     return bitCount(good)
 * 
 * cpdef int countAT(unsigned long int word,unsigned int size):             # <<<<<<<<<<<<<<
 *     cdef unsigned long int mask
 *     cdef unsigned long int shift
 */

static PyObject *__pyx_pf_8obitools_4word_7_binary_12countAT(CYTHON_UNUSED PyObject *__pyx_self, unsigned long __pyx_v_word, unsigned int __pyx_v_size) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("countAT", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_f_8obitools_4word_7_binary_countAT(__pyx_v_word, __pyx_v_size, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("obitools.word._binary.countAT", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":138
 *     return bitCount(good)
 * 
 * cpdef int countC(unsigned long int word,unsigned int size):             # <<<<<<<<<<<<<<
 *     cdef unsigned long int mask
 *     cdef unsigned long int good
 */

static PyObject *__pyx_pw_8obitools_4word_7_binary_15countC(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_8obitools_4word_7_binary_countC(unsigned long __pyx_v_word, unsigned int __pyx_v_size, CYTHON_UNUSED int __pyx_skip_dispatch) {
  unsigned long __pyx_v_mask;
  unsigned long __pyx_v_good;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  unsigned long __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("countC", 0);

  /* "obitools/word/_binary.pyx":142
 *     cdef unsigned long int good
 * 
 *     mask = (1 << (size << 1))-1             # <<<<<<<<<<<<<<
 *     good = ((word & 0x55555555) | (~word & 0xAAAAAAAA))
 *     good &= (good >> 1) & 0x55555555 & mask
 */
  __pyx_v_mask = ((1 << (__pyx_v_size << 1)) - 1);

  /* "obitools/word/_binary.pyx":143
 * 
 *     mask = (1 << (size << 1))-1
 *     good = ((word & 0x55555555) | (~word & 0xAAAAAAAA))             # <<<<<<<<<<<<<<
 *     good &= (good >> 1) & 0x55555555 & mask
 *     return bitCount(good)
 */
  __pyx_t_1 = PyLong_FromUnsignedLong((__pyx_v_word & 0x55555555)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyLong_FromUnsignedLong((~__pyx_v_word)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_And(__pyx_t_2, __pyx_int_2863311530); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_Or(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_4 = __Pyx_PyInt_AsUnsignedLong(__pyx_t_2); if (unlikely((__pyx_t_4 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_good = __pyx_t_4;

  /* "obitools/word/_binary.pyx":144
 *     mask = (1 << (size << 1))-1
 *     good = ((word & 0x55555555) | (~word & 0xAAAAAAAA))
 *     good &= (good >> 1) & 0x55555555 & mask             # <<<<<<<<<<<<<<
 *     return bitCount(good)
 * 
 */
  __pyx_v_good = (__pyx_v_good & (((__pyx_v_good >> 1) & 0x55555555) & __pyx_v_mask));

  /* "obitools/word/_binary.pyx":145
 *     good = ((word & 0x55555555) | (~word & 0xAAAAAAAA))
 *     good &= (good >> 1) & 0x55555555 & mask
 *     return bitCount(good)             # <<<<<<<<<<<<<<
 * 
 * cpdef int countG(unsigned long int word,unsigned int size):
 */
  __pyx_r = __pyx_f_8obitools_4word_7_binary_bitCount(__pyx_v_good);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("obitools.word._binary.countC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8obitools_4word_7_binary_15countC(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8obitools_4word_7_binary_15countC(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned long __pyx_v_word;
  unsigned int __pyx_v_size;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__word,&__pyx_n_s__size,0};
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("countC (wrapper)", 0);
  __pyx_self = __pyx_self;
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__word);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("countC", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "countC") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_word = __Pyx_PyInt_AsUnsignedLong(values[0]); if (unlikely((__pyx_v_word == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_size = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_size == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("countC", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("obitools.word._binary.countC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_14countC(__pyx_self, __pyx_v_word, __pyx_v_size);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":138
 *     return bitCount(good)
 * 
 * cpdef int countC(unsigned long int word,unsigned int size):             # <<<<<<<<<<<<<<
 *     cdef unsigned long int mask
 *     cdef unsigned long int good
 */

static PyObject *__pyx_pf_8obitools_4word_7_binary_14countC(CYTHON_UNUSED PyObject *__pyx_self, unsigned long __pyx_v_word, unsigned int __pyx_v_size) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("countC", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_f_8obitools_4word_7_binary_countC(__pyx_v_word, __pyx_v_size, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("obitools.word._binary.countC", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":147
 *     return bitCount(good)
 * 
 * cpdef int countG(unsigned long int word,unsigned int size):             # <<<<<<<<<<<<<<
 *     cdef unsigned long int mask
 *     cdef unsigned long int good
 */

static PyObject *__pyx_pw_8obitools_4word_7_binary_17countG(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_8obitools_4word_7_binary_countG(unsigned long __pyx_v_word, unsigned int __pyx_v_size, CYTHON_UNUSED int __pyx_skip_dispatch) {
  unsigned long __pyx_v_mask;
  unsigned long __pyx_v_good;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  unsigned long __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("countG", 0);

  /* "obitools/word/_binary.pyx":151
 *     cdef unsigned long int good
 * 
 *     mask = (1 << (size << 1))-1             # <<<<<<<<<<<<<<
 *     good  = ((word & 0xAAAAAAAA) | (~word & 0x55555555))
 *     good &= (good >> 1) & 0x55555555 & mask
 */
  __pyx_v_mask = ((1 << (__pyx_v_size << 1)) - 1);

  /* "obitools/word/_binary.pyx":152
 * 
 *     mask = (1 << (size << 1))-1
 *     good  = ((word & 0xAAAAAAAA) | (~word & 0x55555555))             # <<<<<<<<<<<<<<
 *     good &= (good >> 1) & 0x55555555 & mask
 *     return bitCount(good)
 */
  __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_word); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_And(__pyx_t_1, __pyx_int_2863311530); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyLong_FromUnsignedLong(((~__pyx_v_word) & 0x55555555)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyNumber_Or(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = __Pyx_PyInt_AsUnsignedLong(__pyx_t_3); if (unlikely((__pyx_t_4 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_good = __pyx_t_4;

  /* "obitools/word/_binary.pyx":153
 *     mask = (1 << (size << 1))-1
 *     good  = ((word & 0xAAAAAAAA) | (~word & 0x55555555))
 *     good &= (good >> 1) & 0x55555555 & mask             # <<<<<<<<<<<<<<
 *     return bitCount(good)
 * 
 */
  __pyx_v_good = (__pyx_v_good & (((__pyx_v_good >> 1) & 0x55555555) & __pyx_v_mask));

  /* "obitools/word/_binary.pyx":154
 *     good  = ((word & 0xAAAAAAAA) | (~word & 0x55555555))
 *     good &= (good >> 1) & 0x55555555 & mask
 *     return bitCount(good)             # <<<<<<<<<<<<<<
 * 
 * cpdef int countCG(unsigned long int word,unsigned int size):
 */
  __pyx_r = __pyx_f_8obitools_4word_7_binary_bitCount(__pyx_v_good);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("obitools.word._binary.countG", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8obitools_4word_7_binary_17countG(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8obitools_4word_7_binary_17countG(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned long __pyx_v_word;
  unsigned int __pyx_v_size;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__word,&__pyx_n_s__size,0};
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("countG (wrapper)", 0);
  __pyx_self = __pyx_self;
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__word);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("countG", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "countG") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_word = __Pyx_PyInt_AsUnsignedLong(values[0]); if (unlikely((__pyx_v_word == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_size = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_size == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("countG", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("obitools.word._binary.countG", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_16countG(__pyx_self, __pyx_v_word, __pyx_v_size);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":147
 *     return bitCount(good)
 * 
 * cpdef int countG(unsigned long int word,unsigned int size):             # <<<<<<<<<<<<<<
 *     cdef unsigned long int mask
 *     cdef unsigned long int good
 */

static PyObject *__pyx_pf_8obitools_4word_7_binary_16countG(CYTHON_UNUSED PyObject *__pyx_self, unsigned long __pyx_v_word, unsigned int __pyx_v_size) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("countG", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_f_8obitools_4word_7_binary_countG(__pyx_v_word, __pyx_v_size, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("obitools.word._binary.countG", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":156
 *     return bitCount(good)
 * 
 * cpdef int countCG(unsigned long int word,unsigned int size):             # <<<<<<<<<<<<<<
 *     cdef unsigned long int mask
 *     cdef unsigned long int shift
 */

static PyObject *__pyx_pw_8obitools_4word_7_binary_19countCG(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_8obitools_4word_7_binary_countCG(unsigned long __pyx_v_word, unsigned int __pyx_v_size, CYTHON_UNUSED int __pyx_skip_dispatch) {
  unsigned long __pyx_v_mask;
  unsigned long __pyx_v_shift;
  unsigned long __pyx_v_good;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("countCG", 0);

  /* "obitools/word/_binary.pyx":161
 *     cdef unsigned long int good
 * 
 *     mask = (1 << (size << 1))-1             # <<<<<<<<<<<<<<
 *     shift = word >> 1
 *     good  = ((word & ~shift) | (~word & shift)) & 0x55555555 & mask
 */
  __pyx_v_mask = ((1 << (__pyx_v_size << 1)) - 1);

  /* "obitools/word/_binary.pyx":162
 * 
 *     mask = (1 << (size << 1))-1
 *     shift = word >> 1             # <<<<<<<<<<<<<<
 *     good  = ((word & ~shift) | (~word & shift)) & 0x55555555 & mask
 *     return bitCount(good)
 */
  __pyx_v_shift = (__pyx_v_word >> 1);

  /* "obitools/word/_binary.pyx":163
 *     mask = (1 << (size << 1))-1
 *     shift = word >> 1
 *     good  = ((word & ~shift) | (~word & shift)) & 0x55555555 & mask             # <<<<<<<<<<<<<<
 *     return bitCount(good)
 * 
 */
  __pyx_v_good = ((((__pyx_v_word & (~__pyx_v_shift)) | ((~__pyx_v_word) & __pyx_v_shift)) & 0x55555555) & __pyx_v_mask);

  /* "obitools/word/_binary.pyx":164
 *     shift = word >> 1
 *     good  = ((word & ~shift) | (~word & shift)) & 0x55555555 & mask
 *     return bitCount(good)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_r = __pyx_f_8obitools_4word_7_binary_bitCount(__pyx_v_good);
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8obitools_4word_7_binary_19countCG(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8obitools_4word_7_binary_19countCG(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned long __pyx_v_word;
  unsigned int __pyx_v_size;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__word,&__pyx_n_s__size,0};
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("countCG (wrapper)", 0);
  __pyx_self = __pyx_self;
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__word);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("countCG", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "countCG") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_word = __Pyx_PyInt_AsUnsignedLong(values[0]); if (unlikely((__pyx_v_word == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_size = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_size == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("countCG", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("obitools.word._binary.countCG", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_18countCG(__pyx_self, __pyx_v_word, __pyx_v_size);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":156
 *     return bitCount(good)
 * 
 * cpdef int countCG(unsigned long int word,unsigned int size):             # <<<<<<<<<<<<<<
 *     cdef unsigned long int mask
 *     cdef unsigned long int shift
 */

static PyObject *__pyx_pf_8obitools_4word_7_binary_18countCG(CYTHON_UNUSED PyObject *__pyx_self, unsigned long __pyx_v_word, unsigned int __pyx_v_size) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("countCG", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = PyInt_FromLong(__pyx_f_8obitools_4word_7_binary_countCG(__pyx_v_word, __pyx_v_size, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("obitools.word._binary.countCG", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":167
 * 
 * 
 * cpdef str decodeWord(unsigned long int word,unsigned int size):             # <<<<<<<<<<<<<<
 *     return ''.join(['acgt'[(word >> i) & 3] for i in xrange(size*2-2,-1,-2)])
 * 
 */

static PyObject *__pyx_pw_8obitools_4word_7_binary_21decodeWord(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_8obitools_4word_7_binary_decodeWord(unsigned long __pyx_v_word, unsigned int __pyx_v_size, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("decodeWord", 0);

  /* "obitools/word/_binary.pyx":168
 * 
 * cpdef str decodeWord(unsigned long int word,unsigned int size):
 *     return ''.join(['acgt'[(word >> i) & 3] for i in xrange(size*2-2,-1,-2)])             # <<<<<<<<<<<<<<
 * 
 * cpdef int encodeWord(word) except -1:
 */
  __Pyx_XDECREF(((PyObject *)__pyx_r));
  __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__join); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyInt_FromLong(((__pyx_v_size * 2) - 2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_int_neg_1);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_neg_1);
  __Pyx_GIVEREF(__pyx_int_neg_1);
  __Pyx_INCREF(__pyx_int_neg_2);
  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_int_neg_2);
  __Pyx_GIVEREF(__pyx_int_neg_2);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_Call(__pyx_builtin_xrange, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (!__pyx_t_6 && PyList_CheckExact(__pyx_t_4)) {
      if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++;
    } else if (!__pyx_t_6 && PyTuple_CheckExact(__pyx_t_4)) {
      if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_3); __pyx_t_5++;
    } else {
      __pyx_t_3 = __pyx_t_6(__pyx_t_4);
      if (unlikely(!__pyx_t_3)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF(__pyx_v_i);
    __pyx_v_i = __pyx_t_3;
    __pyx_t_3 = 0;
    __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_word); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = PyNumber_Rshift(__pyx_t_3, __pyx_v_i); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyNumber_And(__pyx_t_7, __pyx_int_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_n_s__acgt), __pyx_t_3); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_7))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(((PyObject *)__pyx_t_2));
  PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_2));
  __Pyx_GIVEREF(((PyObject *)__pyx_t_2));
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
  if (!(likely(PyString_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_2)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = ((PyObject*)__pyx_t_2);
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("obitools.word._binary.decodeWord", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8obitools_4word_7_binary_21decodeWord(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8obitools_4word_7_binary_21decodeWord(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned long __pyx_v_word;
  unsigned int __pyx_v_size;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__word,&__pyx_n_s__size,0};
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("decodeWord (wrapper)", 0);
  __pyx_self = __pyx_self;
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__word);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("decodeWord", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decodeWord") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_word = __Pyx_PyInt_AsUnsignedLong(values[0]); if (unlikely((__pyx_v_word == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_size = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_size == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("decodeWord", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("obitools.word._binary.decodeWord", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_20decodeWord(__pyx_self, __pyx_v_word, __pyx_v_size);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":167
 * 
 * 
 * cpdef str decodeWord(unsigned long int word,unsigned int size):             # <<<<<<<<<<<<<<
 *     return ''.join(['acgt'[(word >> i) & 3] for i in xrange(size*2-2,-1,-2)])
 * 
 */

static PyObject *__pyx_pf_8obitools_4word_7_binary_20decodeWord(CYTHON_UNUSED PyObject *__pyx_self, unsigned long __pyx_v_word, unsigned int __pyx_v_size) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("decodeWord", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = ((PyObject *)__pyx_f_8obitools_4word_7_binary_decodeWord(__pyx_v_word, __pyx_v_size, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("obitools.word._binary.decodeWord", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":170
 *     return ''.join(['acgt'[(word >> i) & 3] for i in xrange(size*2-2,-1,-2)])
 * 
 * cpdef int encodeWord(word) except -1:             # <<<<<<<<<<<<<<
 *     assert len(word)<=32,"Word length should be less or equal to 32"
 *     w=0
 */

static PyObject *__pyx_pw_8obitools_4word_7_binary_23encodeWord(PyObject *__pyx_self, PyObject *__pyx_v_word); /*proto*/
static int __pyx_f_8obitools_4word_7_binary_encodeWord(PyObject *__pyx_v_word, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_v_w = NULL;
  PyObject *__pyx_v_l = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *(*__pyx_t_4)(PyObject *);
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("encodeWord", 0);
  __Pyx_INCREF(__pyx_v_word);

  /* "obitools/word/_binary.pyx":171
 * 
 * cpdef int encodeWord(word) except -1:
 *     assert len(word)<=32,"Word length should be less or equal to 32"             # <<<<<<<<<<<<<<
 *     w=0
 *     word=word.lower()
 */
  #ifndef CYTHON_WITHOUT_ASSERTIONS
  __pyx_t_1 = PyObject_Length(__pyx_v_word); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (unlikely(!(__pyx_t_1 <= 32))) {
    PyErr_SetObject(PyExc_AssertionError, ((PyObject *)__pyx_kp_s_3));
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  #endif

  /* "obitools/word/_binary.pyx":172
 * cpdef int encodeWord(word) except -1:
 *     assert len(word)<=32,"Word length should be less or equal to 32"
 *     w=0             # <<<<<<<<<<<<<<
 *     word=word.lower()
 *     for l in word:
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_w = __pyx_int_0;

  /* "obitools/word/_binary.pyx":173
 *     assert len(word)<=32,"Word length should be less or equal to 32"
 *     w=0
 *     word=word.lower()             # <<<<<<<<<<<<<<
 *     for l in word:
 *         w<<=2
 */
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_word, __pyx_n_s__lower); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_v_word);
  __pyx_v_word = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "obitools/word/_binary.pyx":174
 *     w=0
 *     word=word.lower()
 *     for l in word:             # <<<<<<<<<<<<<<
 *         w<<=2
 *         if l=='c' :
 */
  if (PyList_CheckExact(__pyx_v_word) || PyTuple_CheckExact(__pyx_v_word)) {
    __pyx_t_3 = __pyx_v_word; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_word); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_3)) {
      if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++;
    } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_3)) {
      if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
      __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++;
    } else {
      __pyx_t_2 = __pyx_t_4(__pyx_t_3);
      if (unlikely(!__pyx_t_2)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF(__pyx_v_l);
    __pyx_v_l = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "obitools/word/_binary.pyx":175
 *     word=word.lower()
 *     for l in word:
 *         w<<=2             # <<<<<<<<<<<<<<
 *         if l=='c' :
 *             w|=1
 */
    __pyx_t_2 = PyNumber_InPlaceLshift(__pyx_v_w, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_v_w);
    __pyx_v_w = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "obitools/word/_binary.pyx":176
 *     for l in word:
 *         w<<=2
 *         if l=='c' :             # <<<<<<<<<<<<<<
 *             w|=1
 *         elif l=='g':
 */
    __pyx_t_5 = __Pyx_PyString_Equals(__pyx_v_l, ((PyObject *)__pyx_n_s__c), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "obitools/word/_binary.pyx":177
 *         w<<=2
 *         if l=='c' :
 *             w|=1             # <<<<<<<<<<<<<<
 *         elif l=='g':
 *             w|=2
 */
      __pyx_t_2 = PyNumber_InPlaceOr(__pyx_v_w, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_w);
      __pyx_v_w = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L5;
    }

    /* "obitools/word/_binary.pyx":178
 *         if l=='c' :
 *             w|=1
 *         elif l=='g':             # <<<<<<<<<<<<<<
 *             w|=2
 *         elif l=='t':
 */
    __pyx_t_5 = __Pyx_PyString_Equals(__pyx_v_l, ((PyObject *)__pyx_n_s__g), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "obitools/word/_binary.pyx":179
 *             w|=1
 *         elif l=='g':
 *             w|=2             # <<<<<<<<<<<<<<
 *         elif l=='t':
 *             w|=3
 */
      __pyx_t_2 = PyNumber_InPlaceOr(__pyx_v_w, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_w);
      __pyx_v_w = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L5;
    }

    /* "obitools/word/_binary.pyx":180
 *         elif l=='g':
 *             w|=2
 *         elif l=='t':             # <<<<<<<<<<<<<<
 *             w|=3
 *         elif l!='a':
 */
    __pyx_t_5 = __Pyx_PyString_Equals(__pyx_v_l, ((PyObject *)__pyx_n_s__t), Py_EQ); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "obitools/word/_binary.pyx":181
 *             w|=2
 *         elif l=='t':
 *             w|=3             # <<<<<<<<<<<<<<
 *         elif l!='a':
 *             raise RuntimeError,"word should only contain a, c, g or t (%s)" % word
 */
      __pyx_t_2 = PyNumber_InPlaceOr(__pyx_v_w, __pyx_int_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_v_w);
      __pyx_v_w = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L5;
    }

    /* "obitools/word/_binary.pyx":182
 *         elif l=='t':
 *             w|=3
 *         elif l!='a':             # <<<<<<<<<<<<<<
 *             raise RuntimeError,"word should only contain a, c, g or t (%s)" % word
 *     return w
 */
    __pyx_t_5 = __Pyx_PyString_Equals(__pyx_v_l, ((PyObject *)__pyx_n_s__a), Py_NE); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "obitools/word/_binary.pyx":183
 *             w|=3
 *         elif l!='a':
 *             raise RuntimeError,"word should only contain a, c, g or t (%s)" % word             # <<<<<<<<<<<<<<
 *     return w
 * 
 */
      __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), __pyx_v_word); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_2));
      __Pyx_Raise(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_t_2), 0, 0);
      __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      goto __pyx_L5;
    }
    __pyx_L5:;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "obitools/word/_binary.pyx":184
 *         elif l!='a':
 *             raise RuntimeError,"word should only contain a, c, g or t (%s)" % word
 *     return w             # <<<<<<<<<<<<<<
 * 
 * def encodePattern(pattern):
 */
  __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_v_w); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_r = __pyx_t_6;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("obitools.word._binary.encodeWord", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_w);
  __Pyx_XDECREF(__pyx_v_l);
  __Pyx_XDECREF(__pyx_v_word);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8obitools_4word_7_binary_23encodeWord(PyObject *__pyx_self, PyObject *__pyx_v_word); /*proto*/
static PyObject *__pyx_pw_8obitools_4word_7_binary_23encodeWord(PyObject *__pyx_self, PyObject *__pyx_v_word) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("encodeWord (wrapper)", 0);
  __pyx_self = __pyx_self;
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_22encodeWord(__pyx_self, ((PyObject *)__pyx_v_word));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":170
 *     return ''.join(['acgt'[(word >> i) & 3] for i in xrange(size*2-2,-1,-2)])
 * 
 * cpdef int encodeWord(word) except -1:             # <<<<<<<<<<<<<<
 *     assert len(word)<=32,"Word length should be less or equal to 32"
 *     w=0
 */

static PyObject *__pyx_pf_8obitools_4word_7_binary_22encodeWord(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_word) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("encodeWord", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __pyx_f_8obitools_4word_7_binary_encodeWord(__pyx_v_word, 0); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("obitools.word._binary.encodeWord", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8obitools_4word_7_binary_25encodePattern(PyObject *__pyx_self, PyObject *__pyx_v_pattern); /*proto*/
static PyMethodDef __pyx_mdef_8obitools_4word_7_binary_25encodePattern = {__Pyx_NAMESTR("encodePattern"), (PyCFunction)__pyx_pw_8obitools_4word_7_binary_25encodePattern, METH_O, __Pyx_DOCSTR(0)};
static PyObject *__pyx_pw_8obitools_4word_7_binary_25encodePattern(PyObject *__pyx_self, PyObject *__pyx_v_pattern) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("encodePattern (wrapper)", 0);
  __pyx_self = __pyx_self;
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_24encodePattern(__pyx_self, ((PyObject *)__pyx_v_pattern));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":186
 *     return w
 * 
 * def encodePattern(pattern):             # <<<<<<<<<<<<<<
 *     a=0
 *     c=0
 */

static PyObject *__pyx_pf_8obitools_4word_7_binary_24encodePattern(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pattern) {
  PyObject *__pyx_v_a = NULL;
  PyObject *__pyx_v_c = NULL;
  PyObject *__pyx_v_g = NULL;
  PyObject *__pyx_v_t = NULL;
  PyObject *__pyx_v_l = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("encodePattern", 0);
  __Pyx_INCREF(__pyx_v_pattern);

  /* "obitools/word/_binary.pyx":187
 * 
 * def encodePattern(pattern):
 *     a=0             # <<<<<<<<<<<<<<
 *     c=0
 *     g=0
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_a = __pyx_int_0;

  /* "obitools/word/_binary.pyx":188
 * def encodePattern(pattern):
 *     a=0
 *     c=0             # <<<<<<<<<<<<<<
 *     g=0
 *     t=0
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_c = __pyx_int_0;

  /* "obitools/word/_binary.pyx":189
 *     a=0
 *     c=0
 *     g=0             # <<<<<<<<<<<<<<
 *     t=0
 * 
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_g = __pyx_int_0;

  /* "obitools/word/_binary.pyx":190
 *     c=0
 *     g=0
 *     t=0             # <<<<<<<<<<<<<<
 * 
 *     pattern=pattern.lower()
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_t = __pyx_int_0;

  /* "obitools/word/_binary.pyx":192
 *     t=0
 * 
 *     pattern=pattern.lower()             # <<<<<<<<<<<<<<
 * 
 *     for l in pattern:
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_pattern, __pyx_n_s__lower); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_pattern);
  __pyx_v_pattern = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "obitools/word/_binary.pyx":194
 *     pattern=pattern.lower()
 * 
 *     for l in pattern:             # <<<<<<<<<<<<<<
 *         a<<=2
 *         c<<=2
 */
  if (PyList_CheckExact(__pyx_v_pattern) || PyTuple_CheckExact(__pyx_v_pattern)) {
    __pyx_t_2 = __pyx_v_pattern; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_pattern); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  for (;;) {
    if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
    } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) {
      if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++;
    } else {
      __pyx_t_1 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    __Pyx_XDECREF(__pyx_v_l);
    __pyx_v_l = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "obitools/word/_binary.pyx":195
 * 
 *     for l in pattern:
 *         a<<=2             # <<<<<<<<<<<<<<
 *         c<<=2
 *         g<<=2
 */
    __pyx_t_1 = PyNumber_InPlaceLshift(__pyx_v_a, __pyx_int_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_a);
    __pyx_v_a = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "obitools/word/_binary.pyx":196
 *     for l in pattern:
 *         a<<=2
 *         c<<=2             # <<<<<<<<<<<<<<
 *         g<<=2
 *         t<<=2
 */
    __pyx_t_1 = PyNumber_InPlaceLshift(__pyx_v_c, __pyx_int_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_c);
    __pyx_v_c = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "obitools/word/_binary.pyx":197
 *         a<<=2
 *         c<<=2
 *         g<<=2             # <<<<<<<<<<<<<<
 *         t<<=2
 *         if l in 'armwdhvn':
 */
    __pyx_t_1 = PyNumber_InPlaceLshift(__pyx_v_g, __pyx_int_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_g);
    __pyx_v_g = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "obitools/word/_binary.pyx":198
 *         c<<=2
 *         g<<=2
 *         t<<=2             # <<<<<<<<<<<<<<
 *         if l in 'armwdhvn':
 *             a|=1
 */
    __pyx_t_1 = PyNumber_InPlaceLshift(__pyx_v_t, __pyx_int_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_v_t);
    __pyx_v_t = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "obitools/word/_binary.pyx":199
 *         g<<=2
 *         t<<=2
 *         if l in 'armwdhvn':             # <<<<<<<<<<<<<<
 *             a|=1
 *         if l in 'cymsbhvn':
 */
    __pyx_t_5 = ((PySequence_Contains(((PyObject *)__pyx_n_s__armwdhvn), __pyx_v_l))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "obitools/word/_binary.pyx":200
 *         t<<=2
 *         if l in 'armwdhvn':
 *             a|=1             # <<<<<<<<<<<<<<
 *         if l in 'cymsbhvn':
 *             c|=1
 */
      __pyx_t_1 = PyNumber_InPlaceOr(__pyx_v_a, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_v_a);
      __pyx_v_a = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "obitools/word/_binary.pyx":201
 *         if l in 'armwdhvn':
 *             a|=1
 *         if l in 'cymsbhvn':             # <<<<<<<<<<<<<<
 *             c|=1
 *         if l in 'grksbdvn':
 */
    __pyx_t_5 = ((PySequence_Contains(((PyObject *)__pyx_n_s__cymsbhvn), __pyx_v_l))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "obitools/word/_binary.pyx":202
 *             a|=1
 *         if l in 'cymsbhvn':
 *             c|=1             # <<<<<<<<<<<<<<
 *         if l in 'grksbdvn':
 *             g|=1
 */
      __pyx_t_1 = PyNumber_InPlaceOr(__pyx_v_c, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_v_c);
      __pyx_v_c = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "obitools/word/_binary.pyx":203
 *         if l in 'cymsbhvn':
 *             c|=1
 *         if l in 'grksbdvn':             # <<<<<<<<<<<<<<
 *             g|=1
 *         if l in 'tykwbdhn':
 */
    __pyx_t_5 = ((PySequence_Contains(((PyObject *)__pyx_n_s__grksbdvn), __pyx_v_l))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "obitools/word/_binary.pyx":204
 *             c|=1
 *         if l in 'grksbdvn':
 *             g|=1             # <<<<<<<<<<<<<<
 *         if l in 'tykwbdhn':
 *             t|=1
 */
      __pyx_t_1 = PyNumber_InPlaceOr(__pyx_v_g, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_v_g);
      __pyx_v_g = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "obitools/word/_binary.pyx":205
 *         if l in 'grksbdvn':
 *             g|=1
 *         if l in 'tykwbdhn':             # <<<<<<<<<<<<<<
 *             t|=1
 * 
 */
    __pyx_t_5 = ((PySequence_Contains(((PyObject *)__pyx_n_s__tykwbdhn), __pyx_v_l))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (__pyx_t_5) {

      /* "obitools/word/_binary.pyx":206
 *             g|=1
 *         if l in 'tykwbdhn':
 *             t|=1             # <<<<<<<<<<<<<<
 * 
 *     return WordPattern(a,c,g,t)
 */
      __pyx_t_1 = PyNumber_InPlaceOr(__pyx_v_t, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_v_t);
      __pyx_v_t = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L8;
    }
    __pyx_L8:;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "obitools/word/_binary.pyx":208
 *             t|=1
 * 
 *     return WordPattern(a,c,g,t)             # <<<<<<<<<<<<<<
 * 
 * cpdef bint matchPattern(unsigned long int word,pattern):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_a);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_a);
  __Pyx_GIVEREF(__pyx_v_a);
  __Pyx_INCREF(__pyx_v_c);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_c);
  __Pyx_GIVEREF(__pyx_v_c);
  __Pyx_INCREF(__pyx_v_g);
  PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_g);
  __Pyx_GIVEREF(__pyx_v_g);
  __Pyx_INCREF(__pyx_v_t);
  PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_t);
  __Pyx_GIVEREF(__pyx_v_t);
  __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_8obitools_4word_7_binary_WordPattern)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("obitools.word._binary.encodePattern", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_a);
  __Pyx_XDECREF(__pyx_v_c);
  __Pyx_XDECREF(__pyx_v_g);
  __Pyx_XDECREF(__pyx_v_t);
  __Pyx_XDECREF(__pyx_v_l);
  __Pyx_XDECREF(__pyx_v_pattern);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":210
 *     return WordPattern(a,c,g,t)
 * 
 * cpdef bint matchPattern(unsigned long int word,pattern):             # <<<<<<<<<<<<<<
 *     all   = pattern.a|pattern.c|pattern.g|pattern.t
 *     eq    = ~word
 */

static PyObject *__pyx_pw_8obitools_4word_7_binary_27matchPattern(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_8obitools_4word_7_binary_matchPattern(unsigned long __pyx_v_word, PyObject *__pyx_v_pattern, CYTHON_UNUSED int __pyx_skip_dispatch) {
  PyObject *__pyx_v_all = NULL;
  PyObject *__pyx_v_eq = NULL;
  PyObject *__pyx_v_match = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("matchPattern", 0);

  /* "obitools/word/_binary.pyx":211
 * 
 * cpdef bint matchPattern(unsigned long int word,pattern):
 *     all   = pattern.a|pattern.c|pattern.g|pattern.t             # <<<<<<<<<<<<<<
 *     eq    = ~word
 *     match = eq & (eq >> 1) & pattern.a
 */
  __pyx_t_1 = PyObject_GetAttr(__pyx_v_pattern, __pyx_n_s__a); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_pattern, __pyx_n_s__c); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Or(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_pattern, __pyx_n_s__g); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyNumber_Or(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_pattern, __pyx_n_s__t); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Or(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_all = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "obitools/word/_binary.pyx":212
 * cpdef bint matchPattern(unsigned long int word,pattern):
 *     all   = pattern.a|pattern.c|pattern.g|pattern.t
 *     eq    = ~word             # <<<<<<<<<<<<<<
 *     match = eq & (eq >> 1) & pattern.a
 *     eq    = (word & 0x55555555 | ~word & 0xAAAAAAAA)
 */
  __pyx_t_3 = PyLong_FromUnsignedLong((~__pyx_v_word)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_eq = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "obitools/word/_binary.pyx":213
 *     all   = pattern.a|pattern.c|pattern.g|pattern.t
 *     eq    = ~word
 *     match = eq & (eq >> 1) & pattern.a             # <<<<<<<<<<<<<<
 *     eq    = (word & 0x55555555 | ~word & 0xAAAAAAAA)
 *     match|= eq & (eq >> 1) & pattern.c
 */
  __pyx_t_3 = PyNumber_Rshift(__pyx_v_eq, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyNumber_And(__pyx_v_eq, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_pattern, __pyx_n_s__a); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyNumber_And(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_match = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "obitools/word/_binary.pyx":214
 *     eq    = ~word
 *     match = eq & (eq >> 1) & pattern.a
 *     eq    = (word & 0x55555555 | ~word & 0xAAAAAAAA)             # <<<<<<<<<<<<<<
 *     match|= eq & (eq >> 1) & pattern.c
 *     eq    = (word & 0xAAAAAAAA | ~word & 0x55555555)
 */
  __pyx_t_1 = PyLong_FromUnsignedLong((__pyx_v_word & 0x55555555)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyLong_FromUnsignedLong((~__pyx_v_word)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyNumber_And(__pyx_t_3, __pyx_int_2863311530); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_Or(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_v_eq);
  __pyx_v_eq = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "obitools/word/_binary.pyx":215
 *     match = eq & (eq >> 1) & pattern.a
 *     eq    = (word & 0x55555555 | ~word & 0xAAAAAAAA)
 *     match|= eq & (eq >> 1) & pattern.c             # <<<<<<<<<<<<<<
 *     eq    = (word & 0xAAAAAAAA | ~word & 0x55555555)
 *     match|= eq & (eq >> 1) &  pattern.g
 */
  __pyx_t_3 = PyNumber_Rshift(__pyx_v_eq, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyNumber_And(__pyx_v_eq, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyObject_GetAttr(__pyx_v_pattern, __pyx_n_s__c); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyNumber_And(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyNumber_InPlaceOr(__pyx_v_match, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_match);
  __pyx_v_match = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "obitools/word/_binary.pyx":216
 *     eq    = (word & 0x55555555 | ~word & 0xAAAAAAAA)
 *     match|= eq & (eq >> 1) & pattern.c
 *     eq    = (word & 0xAAAAAAAA | ~word & 0x55555555)             # <<<<<<<<<<<<<<
 *     match|= eq & (eq >> 1) &  pattern.g
 *     eq    = word
 */
  __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_word); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyNumber_And(__pyx_t_3, __pyx_int_2863311530); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyLong_FromUnsignedLong(((~__pyx_v_word) & 0x55555555)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = PyNumber_Or(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_v_eq);
  __pyx_v_eq = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "obitools/word/_binary.pyx":217
 *     match|= eq & (eq >> 1) & pattern.c
 *     eq    = (word & 0xAAAAAAAA | ~word & 0x55555555)
 *     match|= eq & (eq >> 1) &  pattern.g             # <<<<<<<<<<<<<<
 *     eq    = word
 *     match|= eq & (eq >> 1) &  pattern.t
 */
  __pyx_t_2 = PyNumber_Rshift(__pyx_v_eq, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_And(__pyx_v_eq, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_pattern, __pyx_n_s__g); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyNumber_And(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_InPlaceOr(__pyx_v_match, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_v_match);
  __pyx_v_match = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "obitools/word/_binary.pyx":218
 *     eq    = (word & 0xAAAAAAAA | ~word & 0x55555555)
 *     match|= eq & (eq >> 1) &  pattern.g
 *     eq    = word             # <<<<<<<<<<<<<<
 *     match|= eq & (eq >> 1) &  pattern.t
 *     return match == all
 */
  __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_word); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_v_eq);
  __pyx_v_eq = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "obitools/word/_binary.pyx":219
 *     match|= eq & (eq >> 1) &  pattern.g
 *     eq    = word
 *     match|= eq & (eq >> 1) &  pattern.t             # <<<<<<<<<<<<<<
 *     return match == all
 * 
 */
  __pyx_t_2 = PyNumber_Rshift(__pyx_v_eq, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyNumber_And(__pyx_v_eq, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_GetAttr(__pyx_v_pattern, __pyx_n_s__t); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_And(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyNumber_InPlaceOr(__pyx_v_match, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_v_match);
  __pyx_v_match = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "obitools/word/_binary.pyx":220
 *     eq    = word
 *     match|= eq & (eq >> 1) &  pattern.t
 *     return match == all             # <<<<<<<<<<<<<<
 * 
 * cdef class ErrorPositionIterator:
 */
  __pyx_t_2 = PyObject_RichCompare(__pyx_v_match, __pyx_v_all, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_4;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_WriteUnraisable("obitools.word._binary.matchPattern", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_all);
  __Pyx_XDECREF(__pyx_v_eq);
  __Pyx_XDECREF(__pyx_v_match);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8obitools_4word_7_binary_27matchPattern(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_8obitools_4word_7_binary_27matchPattern(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  unsigned long __pyx_v_word;
  PyObject *__pyx_v_pattern = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__word,&__pyx_n_s__pattern,0};
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("matchPattern (wrapper)", 0);
  __pyx_self = __pyx_self;
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__word);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pattern);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("matchPattern", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matchPattern") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_word = __Pyx_PyInt_AsUnsignedLong(values[0]); if (unlikely((__pyx_v_word == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
    __pyx_v_pattern = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("matchPattern", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("obitools.word._binary.matchPattern", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_26matchPattern(__pyx_self, __pyx_v_word, __pyx_v_pattern);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":210
 *     return WordPattern(a,c,g,t)
 * 
 * cpdef bint matchPattern(unsigned long int word,pattern):             # <<<<<<<<<<<<<<
 *     all   = pattern.a|pattern.c|pattern.g|pattern.t
 *     eq    = ~word
 */

static PyObject *__pyx_pf_8obitools_4word_7_binary_26matchPattern(CYTHON_UNUSED PyObject *__pyx_self, unsigned long __pyx_v_word, PyObject *__pyx_v_pattern) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("matchPattern", 0);
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_f_8obitools_4word_7_binary_matchPattern(__pyx_v_word, __pyx_v_pattern, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("obitools.word._binary.matchPattern", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static int __pyx_pw_8obitools_4word_7_binary_21ErrorPositionIterator_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_8obitools_4word_7_binary_21ErrorPositionIterator_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_wordsize = 0;
  PyObject *__pyx_v_errorcount = 0;
  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__wordsize,&__pyx_n_s__errorcount,0};
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__wordsize);
        if (likely(values[0])) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__errorcount);
        if (likely(values[1])) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_wordsize = values[0];
    __pyx_v_errorcount = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("obitools.word._binary.ErrorPositionIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_21ErrorPositionIterator___init__(((struct __pyx_obj_8obitools_4word_7_binary_ErrorPositionIterator *)__pyx_v_self), __pyx_v_wordsize, __pyx_v_errorcount);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":230
 *     cdef bint _end
 * 
 *     def __init__(self,wordsize,errorcount):             # <<<<<<<<<<<<<<
 *         self._wsize=wordsize
 *         self._errors=errorcount
 */

static int __pyx_pf_8obitools_4word_7_binary_21ErrorPositionIterator___init__(struct __pyx_obj_8obitools_4word_7_binary_ErrorPositionIterator *__pyx_v_self, PyObject *__pyx_v_wordsize, PyObject *__pyx_v_errorcount) {
  PyObject *__pyx_v_i = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *(*__pyx_t_5)(PyObject *);
  Py_ssize_t __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "obitools/word/_binary.pyx":231
 * 
 *     def __init__(self,wordsize,errorcount):
 *         self._wsize=wordsize             # <<<<<<<<<<<<<<
 *         self._errors=errorcount
 *         self._mask=0
 */
  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_wordsize); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->_wsize = __pyx_t_1;

  /* "obitools/word/_binary.pyx":232
 *     def __init__(self,wordsize,errorcount):
 *         self._wsize=wordsize
 *         self._errors=errorcount             # <<<<<<<<<<<<<<
 *         self._mask=0
 *         for i in range(errorcount):
 */
  __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_errorcount); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_self->_errors = __pyx_t_1;

  /* "obitools/word/_binary.pyx":233
 *         self._wsize=wordsize
 *         self._errors=errorcount
 *         self._mask=0             # <<<<<<<<<<<<<<
 *         for i in range(errorcount):
 *             self._errorpos[i]=i
 */
  __pyx_v_self->_mask = 0;

  /* "obitools/word/_binary.pyx":234
 *         self._errors=errorcount
 *         self._mask=0
 *         for i in range(errorcount):             # <<<<<<<<<<<<<<
 *             self._errorpos[i]=i
 *         self._end=False
 */
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_errorcount);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_errorcount);
  __Pyx_GIVEREF(__pyx_v_errorcount);
  __pyx_t_3 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0;
  if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0;
    __pyx_t_5 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_2)) {
      if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
    } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_2)) {
      if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
      __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_3); __pyx_t_4++;
    } else {
      __pyx_t_3 = __pyx_t_5(__pyx_t_2);
      if (unlikely(!__pyx_t_3)) {
        if (PyErr_Occurred()) {
          if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF(__pyx_v_i);
    __pyx_v_i = __pyx_t_3;
    __pyx_t_3 = 0;

    /* "obitools/word/_binary.pyx":235
 *         self._mask=0
 *         for i in range(errorcount):
 *             self._errorpos[i]=i             # <<<<<<<<<<<<<<
 *         self._end=False
 * 
 */
    __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_i); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    (__pyx_v_self->_errorpos[__pyx_t_6]) = __pyx_t_1;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "obitools/word/_binary.pyx":236
 *         for i in range(errorcount):
 *             self._errorpos[i]=i
 *         self._end=False             # <<<<<<<<<<<<<<
 * 
 *     def __iter__(self):
 */
  __pyx_v_self->_end = 0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("obitools.word._binary.ErrorPositionIterator.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8obitools_4word_7_binary_21ErrorPositionIterator_3__iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_pw_8obitools_4word_7_binary_21ErrorPositionIterator_3__iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0);
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_21ErrorPositionIterator_2__iter__(((struct __pyx_obj_8obitools_4word_7_binary_ErrorPositionIterator *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":238
 *         self._end=False
 * 
 *     def __iter__(self):             # <<<<<<<<<<<<<<
 *         return self
 * 
 */

static PyObject *__pyx_pf_8obitools_4word_7_binary_21ErrorPositionIterator_2__iter__(struct __pyx_obj_8obitools_4word_7_binary_ErrorPositionIterator *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__iter__", 0);

  /* "obitools/word/_binary.pyx":239
 * 
 *     def __iter__(self):
 *         return self             # <<<<<<<<<<<<<<
 * 
 *     def next(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  __pyx_r = ((PyObject *)__pyx_v_self);
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* Python wrapper */
static PyObject *__pyx_pw_8obitools_4word_7_binary_21ErrorPositionIterator_5next(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_8obitools_4word_7_binary_21ErrorPositionIterator_5next(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("next (wrapper)", 0);
  __pyx_r = __pyx_pf_8obitools_4word_7_binary_21ErrorPositionIterator_4next(((struct __pyx_obj_8obitools_4word_7_binary_ErrorPositionIterator *)__pyx_v_self));
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "obitools/word/_binary.pyx":241
 *         return self
 * 
 *     def next(self):             # <<<<<<<<<<<<<<
 *         cdef unsigned long int rep
 *         cdef bint move=False
 */

static PyObject *__pyx_pf_8obitools_4word_7_binary_21ErrorPositionIterator_4next(struct __pyx_obj_8obitools_4word_7_binary_ErrorPositionIterator *__pyx_v_self) {
  unsigned long __pyx_v_rep;
  int __pyx_v_move;
  int __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("next", 0);

  /* "obitools/word/_binary.pyx":243
 *     def next(self):
 *         cdef unsigned long int rep
 *         cdef bint move=False             # <<<<<<<<<<<<<<
 *         cdef int i
 *         if self._end:
 */
  __pyx_v_move = 0;

  /* "obitools/word/_binary.pyx":245
 *         cdef bint move=False
 *         cdef int i
 *         if self._end:             # <<<<<<<<<<<<<<
 *             raise StopIteration
 * 
 */
  if (__pyx_v_self->_end) {

    /* "obitools/word/_binary.pyx":246
 *         cdef int i
 *         if self._end:
 *             raise StopIteration             # <<<<<<<<<<<<<<
 * 
 *         rep = 0
 */
    __Pyx_Raise(__pyx_builtin_StopIteration, 0, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "obitools/word/_binary.pyx":248
 *             raise StopIteration
 * 
 *         rep = 0             # <<<<<<<<<<<<<<
 *         for i in range(self._errors):
 *             rep |= 1 << self._errorpos[i]
 */
  __pyx_v_rep = 0;

  /* "obitools/word/_binary.pyx":249
 * 
 *         rep = 0
 *         for i in range(self._errors):             # <<<<<<<<<<<<<<
 *             rep |= 1 << self._errorpos[i]
 *             print bin2str(rep)
 */
  __pyx_t_1 = __pyx_v_self->_errors;
  for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) {
    __pyx_v_i = __pyx_t_2;

    /* "obitools/word/_binary.pyx":250
 *         rep = 0
 *         for i in range(self._errors):
 *             rep |= 1 << self._errorpos[i]             # <<<<<<<<<<<<<<
 *             print bin2str(rep)
 * 
 */
    __pyx_v_rep = (__pyx_v_rep | (1 << (__pyx_v_self->_errorpos[__pyx_v_i])));

    /* "obitools/word/_binary.pyx":251
 *         for i in range(self._errors):
 *             rep |= 1 << self._errorpos[i]
 *             print bin2str(rep)             # <<<<<<<<<<<<<<
 * 
 *         move=False
 */
    __pyx_t_3 = ((PyObject *)__pyx_f_8obitools_4word_7_binary_bin2str(__pyx_v_rep, 0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_PrintOne(0, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }

  /* "obitools/word/_binary.pyx":253
 *             print bin2str(rep)
 * 
 *         move=False             # <<<<<<<<<<<<<<
 *         i=0
 *         while (not move):
 */
  __pyx_v_move = 0;

  /* "obitools/word/_binary.pyx":254
 * 
 *         move=False
 *         i=0             # <<<<<<<<<<<<<<
 *         while (not move):
 *             if self._errorpos[i]<self._errorpos[i+1]-1:
 */
  __pyx_v_i = 0;

  /* "obitools/word/_binary.pyx":255
 *         move=False
 *         i=0
 *         while (not move):             # <<<<<<<<<<<<<<
 *             if self._errorpos[i]<self._errorpos[i+1]-1:
 *                  self._errorpos[i]+=1
 */
  while (1) {
    __pyx_t_4 = (!__pyx_v_move);
    if (!__pyx_t_4) break;

    /* "obitools/word/_binary.pyx":256
 *         i=0
 *         while (not move):
 *             if self._errorpos[i]<self._errorpos[i+1]-1:             # <<<<<<<<<<<<<<
 *                  self._errorpos[i]+=1
 *                  move=True
 */
    __pyx_t_4 = ((__pyx_v_self->_errorpos[__pyx_v_i]) < ((__pyx_v_self->_errorpos[(__pyx_v_i + 1)]) - 1));
    if (__pyx_t_4) {

      /* "obitools/word/_binary.pyx":257
 *         while (not move):
 *             if self._errorpos[i]<self._errorpos[i+1]-1:
 *                  self._errorpos[i]+=1             # <<<<<<<<<<<<<<
 *                  move=True
 *                  i=0
 */
      __pyx_t_1 = __pyx_v_i;
      (__pyx_v_self->_errorpos[__pyx_t_1]) = ((__pyx_v_self->_errorpos[__pyx_t_1]) + 1);

      /* "obitools/word/_binary.pyx":258
 *             if self._errorpos[i]<self._errorpos[i+1]-1:
 *                  self._errorpos[i]+=1
 *                  move=True             # <<<<<<<<<<<<<<
 *                  i=0
 *                  print "pos %d/%d moved" % (i,self._wsize)
 */
      __pyx_v_move = 1;

      /* "obitools/word/_binary.pyx":259
 *                  self._errorpos[i]+=1
 *                  move=True
 *                  i=0             # <<<<<<<<<<<<<<
 *                  print "pos %d/%d moved" % (i,self._wsize)
 *             else:
 */
      __pyx_v_i = 0;

      /* "obitools/word/_binary.pyx":260
 *                  move=True
 *                  i=0
 *                  print "pos %d/%d moved" % (i,self._wsize)             # <<<<<<<<<<<<<<
 *             else:
 *                 self._errorpos[i]=i
 */
      __pyx_t_3 = PyInt_FromLong(__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyInt_FromLong(__pyx_v_self->_wsize); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __pyx_t_3 = 0;
      __pyx_t_5 = 0;
      __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(((PyObject *)__pyx_t_5));
      __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0;
      if (__Pyx_PrintOne(0, ((PyObject *)__pyx_t_5)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0;
      goto __pyx_L8;
    }
    /*else*/ {

      /* "obitools/word/_binary.pyx":262
 *                  print "pos %d/%d moved" % (i,self._wsize)
 *             else:
 *                 self._errorpos[i]=i             # <<<<<<<<<<<<<<
 *                 i+=1
 *             if i==self._errors-1 and self._errorpos[i]==self._wsize:
 */
      (__pyx_v_self->_errorpos[__pyx_v_i]) = __pyx_v_i;

      /* "obitools/word/_binary.pyx":263
 *             else:
 *                 self._errorpos[i]=i
 *                 i+=1             # <<<<<<<<<<<<<<
 *             if i==self._errors-1 and self._errorpos[i]==self._wsize:
 *                 self._end=True
 */
      __pyx_v_i = (__pyx_v_i + 1);
    }
    __pyx_L8:;

    /* "obitools/word/_binary.pyx":264
 *                 self._errorpos[i]=i
 *                 i+=1
 *             if i==self._errors-1 and self._errorpos[i]==self._wsize:             # <<<<<<<<<<<<<<
 *                 self._end=True
 *                 move=True
 */
    __pyx_t_4 = (__pyx_v_i == (__pyx_v_self->_errors - 1));
    if (__pyx_t_4) {
      __pyx_t_7 = ((__pyx_v_self->_errorpos[__pyx_v_i]) == __pyx_v_self->_wsize);
      __pyx_t_8 = __pyx_t_7;
    } else {
      __pyx_t_8 = __pyx_t_4;
    }
    if (__pyx_t_8) {

      /* "obitools/word/_binary.pyx":265
 *                 i+=1
 *             if i==self._errors-1 and self._errorpos[i]==self._wsize:
 *                 self._end=True             # <<<<<<<<<<<<<<
 *                 move=True
 * 
 */
      __pyx_v_self->_end = 1;

      /* "obitools/word/_binary.pyx":266
 *             if i==self._errors-1 and self._errorpos[i]==self._wsize:
 *                 self._end=True
 *                 move=True             # <<<<<<<<<<<<<<
 * 
 *         return rep
 */
      __pyx_v_move = 1;
      goto __pyx_L9;
    }
    __pyx_L9:;
  }

  /* "obitools/word/_binary.pyx":268
 *                 move=True
 * 
 *         return rep             # <<<<<<<<<<<<<<
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = PyLong_FromUnsignedLong(__pyx_v_rep); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_r = __pyx_t_5;
  __pyx_t_5 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("obitools.word._binary.ErrorPositionIterator.next", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_tp_new_8obitools_4word_7_binary_WordPattern(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  return o;
}

static void __pyx_tp_dealloc_8obitools_4word_7_binary_WordPattern(PyObject *o) {
  (*Py_TYPE(o)->tp_free)(o);
}

static PyObject *__pyx_getprop_8obitools_4word_7_binary_11WordPattern_a(PyObject *o, void *x) {
  return __pyx_pw_8obitools_4word_7_binary_11WordPattern_1a_1__get__(o);
}

static int __pyx_setprop_8obitools_4word_7_binary_11WordPattern_a(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pw_8obitools_4word_7_binary_11WordPattern_1a_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8obitools_4word_7_binary_11WordPattern_c(PyObject *o, void *x) {
  return __pyx_pw_8obitools_4word_7_binary_11WordPattern_1c_1__get__(o);
}

static int __pyx_setprop_8obitools_4word_7_binary_11WordPattern_c(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pw_8obitools_4word_7_binary_11WordPattern_1c_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8obitools_4word_7_binary_11WordPattern_g(PyObject *o, void *x) {
  return __pyx_pw_8obitools_4word_7_binary_11WordPattern_1g_1__get__(o);
}

static int __pyx_setprop_8obitools_4word_7_binary_11WordPattern_g(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pw_8obitools_4word_7_binary_11WordPattern_1g_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyObject *__pyx_getprop_8obitools_4word_7_binary_11WordPattern_t(PyObject *o, void *x) {
  return __pyx_pw_8obitools_4word_7_binary_11WordPattern_1t_1__get__(o);
}

static int __pyx_setprop_8obitools_4word_7_binary_11WordPattern_t(PyObject *o, PyObject *v, void *x) {
  if (v) {
    return __pyx_pw_8obitools_4word_7_binary_11WordPattern_1t_3__set__(o, v);
  }
  else {
    PyErr_SetString(PyExc_NotImplementedError, "__del__");
    return -1;
  }
}

static PyMethodDef __pyx_methods_8obitools_4word_7_binary_WordPattern[] = {
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_8obitools_4word_7_binary_WordPattern[] = {
  {(char *)"a", __pyx_getprop_8obitools_4word_7_binary_11WordPattern_a, __pyx_setprop_8obitools_4word_7_binary_11WordPattern_a, 0, 0},
  {(char *)"c", __pyx_getprop_8obitools_4word_7_binary_11WordPattern_c, __pyx_setprop_8obitools_4word_7_binary_11WordPattern_c, 0, 0},
  {(char *)"g", __pyx_getprop_8obitools_4word_7_binary_11WordPattern_g, __pyx_setprop_8obitools_4word_7_binary_11WordPattern_g, 0, 0},
  {(char *)"t", __pyx_getprop_8obitools_4word_7_binary_11WordPattern_t, __pyx_setprop_8obitools_4word_7_binary_11WordPattern_t, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_WordPattern = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_WordPattern = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_WordPattern = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_WordPattern = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_8obitools_4word_7_binary_WordPattern = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("obitools.word._binary.WordPattern"), /*tp_name*/
  sizeof(struct __pyx_obj_8obitools_4word_7_binary_WordPattern), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8obitools_4word_7_binary_WordPattern, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_WordPattern, /*tp_as_number*/
  &__pyx_tp_as_sequence_WordPattern, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_WordPattern, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_pw_8obitools_4word_7_binary_11WordPattern_3__str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_WordPattern, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8obitools_4word_7_binary_WordPattern, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_8obitools_4word_7_binary_WordPattern, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_8obitools_4word_7_binary_11WordPattern_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8obitools_4word_7_binary_WordPattern, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyObject *__pyx_tp_new_8obitools_4word_7_binary_ErrorPositionIterator(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  return o;
}

static void __pyx_tp_dealloc_8obitools_4word_7_binary_ErrorPositionIterator(PyObject *o) {
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_8obitools_4word_7_binary_ErrorPositionIterator[] = {
  {__Pyx_NAMESTR("next"), (PyCFunction)__pyx_pw_8obitools_4word_7_binary_21ErrorPositionIterator_5next, METH_NOARGS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_ErrorPositionIterator = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_divide*/
  #endif
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_coerce*/
  #endif
  0, /*nb_int*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_long*/
  #else
  0, /*reserved*/
  #endif
  0, /*nb_float*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_oct*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*nb_hex*/
  #endif
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  #if PY_MAJOR_VERSION < 3
  0, /*nb_inplace_divide*/
  #endif
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
  #if PY_VERSION_HEX >= 0x02050000
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_ErrorPositionIterator = {
  0, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_ErrorPositionIterator = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_ErrorPositionIterator = {
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getreadbuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getwritebuffer*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getsegcount*/
  #endif
  #if PY_MAJOR_VERSION < 3
  0, /*bf_getcharbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_getbuffer*/
  #endif
  #if PY_VERSION_HEX >= 0x02060000
  0, /*bf_releasebuffer*/
  #endif
};

static PyTypeObject __pyx_type_8obitools_4word_7_binary_ErrorPositionIterator = {
  PyVarObject_HEAD_INIT(0, 0)
  __Pyx_NAMESTR("obitools.word._binary.ErrorPositionIterator"), /*tp_name*/
  sizeof(struct __pyx_obj_8obitools_4word_7_binary_ErrorPositionIterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_8obitools_4word_7_binary_ErrorPositionIterator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  &__pyx_tp_as_number_ErrorPositionIterator, /*tp_as_number*/
  &__pyx_tp_as_sequence_ErrorPositionIterator, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_ErrorPositionIterator, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_ErrorPositionIterator, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_pw_8obitools_4word_7_binary_21ErrorPositionIterator_3__iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_8obitools_4word_7_binary_ErrorPositionIterator, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_pw_8obitools_4word_7_binary_21ErrorPositionIterator_1__init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_8obitools_4word_7_binary_ErrorPositionIterator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  #if PY_VERSION_HEX >= 0x02060000
  0, /*tp_version_tag*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {__Pyx_NAMESTR("bin2str"), (PyCFunction)__pyx_pw_8obitools_4word_7_binary_1bin2str, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("wordDist"), (PyCFunction)__pyx_pw_8obitools_4word_7_binary_5wordDist, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8obitools_4word_7_binary_4wordDist)},
  {__Pyx_NAMESTR("homoMax"), (PyCFunction)__pyx_pw_8obitools_4word_7_binary_7homoMax, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("countA"), (PyCFunction)__pyx_pw_8obitools_4word_7_binary_9countA, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("countT"), (PyCFunction)__pyx_pw_8obitools_4word_7_binary_11countT, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("countAT"), (PyCFunction)__pyx_pw_8obitools_4word_7_binary_13countAT, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("countC"), (PyCFunction)__pyx_pw_8obitools_4word_7_binary_15countC, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("countG"), (PyCFunction)__pyx_pw_8obitools_4word_7_binary_17countG, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("countCG"), (PyCFunction)__pyx_pw_8obitools_4word_7_binary_19countCG, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("decodeWord"), (PyCFunction)__pyx_pw_8obitools_4word_7_binary_21decodeWord, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("encodeWord"), (PyCFunction)__pyx_pw_8obitools_4word_7_binary_23encodeWord, METH_O, __Pyx_DOCSTR(0)},
  {__Pyx_NAMESTR("matchPattern"), (PyCFunction)__pyx_pw_8obitools_4word_7_binary_27matchPattern, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)},
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
    PyModuleDef_HEAD_INIT,
    __Pyx_NAMESTR("_binary"),
    __Pyx_DOCSTR(__pyx_k_6), /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0},
  {&__pyx_n_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 1},
  {&__pyx_kp_b_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 0, 0},
  {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0},
  {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0},
  {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0},
  {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
  {&__pyx_kp_s__0, __pyx_k__0, sizeof(__pyx_k__0), 0, 0, 1, 0},
  {&__pyx_kp_s__1, __pyx_k__1, sizeof(__pyx_k__1), 0, 0, 1, 0},
  {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1},
  {&__pyx_n_s__StopIteration, __pyx_k__StopIteration, sizeof(__pyx_k__StopIteration), 0, 0, 1, 1},
  {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1},
  {&__pyx_n_s__a, __pyx_k__a, sizeof(__pyx_k__a), 0, 0, 1, 1},
  {&__pyx_n_s__acgt, __pyx_k__acgt, sizeof(__pyx_k__acgt), 0, 0, 1, 1},
  {&__pyx_n_s__allDNAWordIterator, __pyx_k__allDNAWordIterator, sizeof(__pyx_k__allDNAWordIterator), 0, 0, 1, 1},
  {&__pyx_n_s__armwdhvn, __pyx_k__armwdhvn, sizeof(__pyx_k__armwdhvn), 0, 0, 1, 1},
  {&__pyx_n_s__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 1, 1},
  {&__pyx_n_s__cymsbhvn, __pyx_k__cymsbhvn, sizeof(__pyx_k__cymsbhvn), 0, 0, 1, 1},
  {&__pyx_n_s__encodePattern, __pyx_k__encodePattern, sizeof(__pyx_k__encodePattern), 0, 0, 1, 1},
  {&__pyx_n_s__errorcount, __pyx_k__errorcount, sizeof(__pyx_k__errorcount), 0, 0, 1, 1},
  {&__pyx_n_s__g, __pyx_k__g, sizeof(__pyx_k__g), 0, 0, 1, 1},
  {&__pyx_n_s__grksbdvn, __pyx_k__grksbdvn, sizeof(__pyx_k__grksbdvn), 0, 0, 1, 1},
  {&__pyx_n_s__join, __pyx_k__join, sizeof(__pyx_k__join), 0, 0, 1, 1},
  {&__pyx_n_s__l, __pyx_k__l, sizeof(__pyx_k__l), 0, 0, 1, 1},
  {&__pyx_n_s__lower, __pyx_k__lower, sizeof(__pyx_k__lower), 0, 0, 1, 1},
  {&__pyx_n_s__maxi, __pyx_k__maxi, sizeof(__pyx_k__maxi), 0, 0, 1, 1},
  {&__pyx_n_s__maxword, __pyx_k__maxword, sizeof(__pyx_k__maxword), 0, 0, 1, 1},
  {&__pyx_n_s__pattern, __pyx_k__pattern, sizeof(__pyx_k__pattern), 0, 0, 1, 1},
  {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1},
  {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1},
  {&__pyx_n_s__t, __pyx_k__t, sizeof(__pyx_k__t), 0, 0, 1, 1},
  {&__pyx_n_s__tykwbdhn, __pyx_k__tykwbdhn, sizeof(__pyx_k__tykwbdhn), 0, 0, 1, 1},
  {&__pyx_n_s__w1, __pyx_k__w1, sizeof(__pyx_k__w1), 0, 0, 1, 1},
  {&__pyx_n_s__w2, __pyx_k__w2, sizeof(__pyx_k__w2), 0, 0, 1, 1},
  {&__pyx_n_s__word, __pyx_k__word, sizeof(__pyx_k__word), 0, 0, 1, 1},
  {&__pyx_n_s__wordsize, __pyx_k__wordsize, sizeof(__pyx_k__wordsize), 0, 0, 1, 1},
  {&__pyx_n_s__xrange, __pyx_k__xrange, sizeof(__pyx_k__xrange), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if PY_MAJOR_VERSION >= 3
  __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #else
  __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_n_s__StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "obitools/word/_binary.pyx":60
 *     return i
 * 
 * def allDNAWordIterator(size):             # <<<<<<<<<<<<<<
 *     '''
 *     Iterate thought the list of all DNA word of
 */
  __pyx_k_tuple_7 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_7);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__size));
  PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, ((PyObject *)__pyx_n_s__size));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__maxi));
  PyTuple_SET_ITEM(__pyx_k_tuple_7, 1, ((PyObject *)__pyx_n_s__maxi));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__maxi));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7));
  __pyx_k_codeobj_8 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_9, __pyx_n_s__allDNAWordIterator, 60, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "obitools/word/_binary.pyx":186
 *     return w
 * 
 * def encodePattern(pattern):             # <<<<<<<<<<<<<<
 *     a=0
 *     c=0
 */
  __pyx_k_tuple_11 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_k_tuple_11);
  __Pyx_INCREF(((PyObject *)__pyx_n_s__pattern));
  PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_n_s__pattern));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pattern));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__a));
  PyTuple_SET_ITEM(__pyx_k_tuple_11, 1, ((PyObject *)__pyx_n_s__a));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__c));
  PyTuple_SET_ITEM(__pyx_k_tuple_11, 2, ((PyObject *)__pyx_n_s__c));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__g));
  PyTuple_SET_ITEM(__pyx_k_tuple_11, 3, ((PyObject *)__pyx_n_s__g));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__g));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__t));
  PyTuple_SET_ITEM(__pyx_k_tuple_11, 4, ((PyObject *)__pyx_n_s__t));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__t));
  __Pyx_INCREF(((PyObject *)__pyx_n_s__l));
  PyTuple_SET_ITEM(__pyx_k_tuple_11, 5, ((PyObject *)__pyx_n_s__l));
  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l));
  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11));
  __pyx_k_codeobj_12 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_9, __pyx_n_s__encodePattern, 186, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_neg_2 = PyInt_FromLong(-2); if (unlikely(!__pyx_int_neg_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_int_2863311530 = PyInt_FromString((char *)"2863311530", 0, 0); if (unlikely(!__pyx_int_2863311530)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC init_binary(void); /*proto*/
PyMODINIT_FUNC init_binary(void)
#else
PyMODINIT_FUNC PyInit__binary(void); /*proto*/
PyMODINIT_FUNC PyInit__binary(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannyDeclarations
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__binary(void)", 0);
  if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #ifdef __Pyx_CyFunction_USED
  if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_binary"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_6), 0, PYTHON_API_VERSION);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  #if PY_MAJOR_VERSION < 3
  Py_INCREF(__pyx_m);
  #endif
  __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME));
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_module_is_main_obitools__word___binary) {
    if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Constants init code ---*/
  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  if (PyType_Ready(&__pyx_type_8obitools_4word_7_binary_WordPattern) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "WordPattern", (PyObject *)&__pyx_type_8obitools_4word_7_binary_WordPattern) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_8obitools_4word_7_binary_WordPattern = &__pyx_type_8obitools_4word_7_binary_WordPattern;
  if (PyType_Ready(&__pyx_type_8obitools_4word_7_binary_ErrorPositionIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__Pyx_SetAttrString(__pyx_m, "ErrorPositionIterator", (PyObject *)&__pyx_type_8obitools_4word_7_binary_ErrorPositionIterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_8obitools_4word_7_binary_ErrorPositionIterator = &__pyx_type_8obitools_4word_7_binary_ErrorPositionIterator;
  /*--- Type import code ---*/
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "obitools/word/_binary.pyx":8
 * 
 * 
 * maxword = sizeof(unsigned long int) * 8 /2             # <<<<<<<<<<<<<<
 * 
 * cdef import from "math.h":
 */
  __pyx_t_1 = __Pyx_PyInt_FromSize_t((((sizeof(unsigned long)) * 8) / 2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__maxword, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "obitools/word/_binary.pyx":60
 *     return i
 * 
 * def allDNAWordIterator(size):             # <<<<<<<<<<<<<<
 *     '''
 *     Iterate thought the list of all DNA word of
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8obitools_4word_7_binary_3allDNAWordIterator, NULL, __pyx_n_s_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__allDNAWordIterator, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "obitools/word/_binary.pyx":186
 *     return w
 * 
 * def encodePattern(pattern):             # <<<<<<<<<<<<<<
 *     a=0
 *     c=0
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8obitools_4word_7_binary_25encodePattern, NULL, __pyx_n_s_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s__encodePattern, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "obitools/word/_binary.pyx":1
 * '''             # <<<<<<<<<<<<<<
 * Created on 2 juil. 2009
 * 
 */
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(((PyObject *)__pyx_t_1));
  if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  if (__pyx_m) {
    __Pyx_AddTraceback("init obitools.word._binary", __pyx_clineno, __pyx_lineno, __pyx_filename);
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init obitools.word._binary");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* Runtime support code */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif /* CYTHON_REFNANNY */

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    PyObject *result;
    result = PyObject_GetAttr(dict, name);
    if (!result) {
        if (dict != __pyx_b) {
            PyErr_Clear();
            result = PyObject_GetAttr(__pyx_b, name);
        }
        if (!result) {
            PyErr_SetObject(PyExc_NameError, name);
        }
    }
    return result;
}

static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AS_STRING(kw_name));
        #endif
}

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
        } else {
            #if PY_MAJOR_VERSION < 3
            if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) {
            #else
            if (unlikely(!PyUnicode_Check(key))) {
            #endif
                goto invalid_keyword_type;
            } else {
                for (name = first_kw_arg; *name; name++) {
                    #if PY_MAJOR_VERSION >= 3
                    if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                        PyUnicode_Compare(**name, key) == 0) break;
                    #else
                    if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                        _PyString_Eq(**name, key)) break;
                    #endif
                }
                if (*name) {
                    values[name-argnames] = value;
                } else {
                    for (name=argnames; name != first_kw_arg; name++) {
                        if (**name == key) goto arg_passed_twice;
                        #if PY_MAJOR_VERSION >= 3
                        if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) &&
                            PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice;
                        #else
                        if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) &&
                            _PyString_Eq(**name, key)) goto arg_passed_twice;
                        #endif
                    }
                    if (kwds2) {
                        if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
                    } else {
                        goto invalid_keyword;
                    }
                }
            }
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, **name);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%s() got an unexpected keyword argument '%s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_Restore(type, value, tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(type, value, tb);
#endif
}

#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    Py_XINCREF(type);
    Py_XINCREF(value);
    Py_XINCREF(tb);
    if (tb == Py_None) {
        Py_DECREF(tb);
        tb = 0;
    }
    else if (tb != NULL && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto raise_error;
    }
    if (value == NULL) {
        value = Py_None;
        Py_INCREF(value);
    }
    #if PY_VERSION_HEX < 0x02050000
    if (!PyClass_Check(type))
    #else
    if (!PyType_Check(type))
    #endif
    {
        if (value != Py_None) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        Py_DECREF(value);
        value = type;
        #if PY_VERSION_HEX < 0x02050000
            if (PyInstance_Check(type)) {
                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
                Py_INCREF(type);
            }
            else {
                type = 0;
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception must be an old-style class or instance");
                goto raise_error;
            }
        #else
            type = (PyObject*) Py_TYPE(type);
            Py_INCREF(type);
            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception class must be a subclass of BaseException");
                goto raise_error;
            }
        #endif
    }
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else /* Python 3+ */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (!PyExceptionClass_Check(type)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
    if (cause) {
        PyObject *fixed_cause;
        if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        }
        else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        }
        else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        if (!value) {
            value = PyObject_CallObject(type, NULL);
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
    }
bad:
    return;
}
#endif

static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) {
            return (equals == Py_NE);
        } else if (PyBytes_GET_SIZE(s1) == 1) {
            if (equals == Py_EQ)
                return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]);
            else
                return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]);
        } else {
            int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1));
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
}

static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) {
        #if CYTHON_PEP393_ENABLED
        if ((PyUnicode_READY(s1) < 0) || (PyUnicode_READY(s2) < 0))
            return -1;
        if (PyUnicode_GET_LENGTH(s1) != PyUnicode_GET_LENGTH(s2)) {
            return (equals == Py_NE);
        } else if (PyUnicode_GET_LENGTH(s1) == 1) {
            Py_UCS4 ch1 = PyUnicode_READ_CHAR(s1, 0);
            Py_UCS4 ch2 = PyUnicode_READ_CHAR(s2, 0);
            return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2);
        #else
        if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) {
            return (equals == Py_NE);
        } else if (PyUnicode_GET_SIZE(s1) == 1) {
            Py_UNICODE ch1 = PyUnicode_AS_UNICODE(s1)[0];
            Py_UNICODE ch2 = PyUnicode_AS_UNICODE(s2)[0];
            return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2);
        #endif
        } else {
            int result = PyUnicode_Compare(s1, s2);
            if ((result == -1) && unlikely(PyErr_Occurred()))
                return -1;
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
}

#if PY_MAJOR_VERSION < 3
static PyObject *__Pyx_GetStdout(void) {
    PyObject *f = PySys_GetObject((char *)"stdout");
    if (!f) {
        PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
    }
    return f;
}
static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
    PyObject* v;
    int i;
    if (!f) {
        if (!(f = __Pyx_GetStdout()))
            return -1;
    }
    for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
        if (PyFile_SoftSpace(f, 1)) {
            if (PyFile_WriteString(" ", f) < 0)
                return -1;
        }
        v = PyTuple_GET_ITEM(arg_tuple, i);
        if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
            return -1;
        if (PyString_Check(v)) {
            char *s = PyString_AsString(v);
            Py_ssize_t len = PyString_Size(v);
            if (len > 0 &&
                isspace(Py_CHARMASK(s[len-1])) &&
                s[len-1] != ' ')
                    PyFile_SoftSpace(f, 0);
        }
    }
    if (newline) {
        if (PyFile_WriteString("\n", f) < 0)
            return -1;
        PyFile_SoftSpace(f, 0);
    }
    return 0;
}
#else /* Python 3 has a print function */
static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
    PyObject* kwargs = 0;
    PyObject* result = 0;
    PyObject* end_string;
    if (unlikely(!__pyx_print)) {
        __pyx_print = __Pyx_GetAttrString(__pyx_b, "print");
        if (!__pyx_print)
            return -1;
    }
    if (stream) {
        kwargs = PyDict_New();
        if (unlikely(!kwargs))
            return -1;
        if (unlikely(PyDict_SetItemString(kwargs, "file", stream) < 0))
            goto bad;
        if (!newline) {
            end_string = PyUnicode_FromStringAndSize(" ", 1);
            if (unlikely(!end_string))
                goto bad;
            if (PyDict_SetItemString(kwargs, "end", end_string) < 0) {
                Py_DECREF(end_string);
                goto bad;
            }
            Py_DECREF(end_string);
        }
    } else if (!newline) {
        if (unlikely(!__pyx_print_kwargs)) {
            __pyx_print_kwargs = PyDict_New();
            if (unlikely(!__pyx_print_kwargs))
                return -1;
            end_string = PyUnicode_FromStringAndSize(" ", 1);
            if (unlikely(!end_string))
                return -1;
            if (PyDict_SetItemString(__pyx_print_kwargs, "end", end_string) < 0) {
                Py_DECREF(end_string);
                return -1;
            }
            Py_DECREF(end_string);
        }
        kwargs = __pyx_print_kwargs;
    }
    result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
    if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs))
        Py_DECREF(kwargs);
    if (!result)
        return -1;
    Py_DECREF(result);
    return 0;
bad:
    if (kwargs != __pyx_print_kwargs)
        Py_XDECREF(kwargs);
    return -1;
}
#endif

#if PY_MAJOR_VERSION < 3
static int __Pyx_PrintOne(PyObject* f, PyObject *o) {
    if (!f) {
        if (!(f = __Pyx_GetStdout()))
            return -1;
    }
    if (PyFile_SoftSpace(f, 0)) {
        if (PyFile_WriteString(" ", f) < 0)
            return -1;
    }
    if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
        return -1;
    if (PyFile_WriteString("\n", f) < 0)
        return -1;
    return 0;
    /* the line below is just to avoid compiler
     * compiler warnings about unused functions */
    return __Pyx_Print(f, NULL, 0);
}
#else /* Python 3 has a print function */
static int __Pyx_PrintOne(PyObject* stream, PyObject *o) {
    int res;
    PyObject* arg_tuple = PyTuple_New(1);
    if (unlikely(!arg_tuple))
        return -1;
    Py_INCREF(o);
    PyTuple_SET_ITEM(arg_tuple, 0, o);
    res = __Pyx_Print(stream, arg_tuple, 1);
    Py_DECREF(arg_tuple);
    return res;
}
#endif

static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) {
    const unsigned char neg_one = (unsigned char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned char" :
                    "value too large to convert to unsigned char");
            }
            return (unsigned char)-1;
        }
        return (unsigned char)val;
    }
    return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) {
    const unsigned short neg_one = (unsigned short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned short" :
                    "value too large to convert to unsigned short");
            }
            return (unsigned short)-1;
        }
        return (unsigned short)val;
    }
    return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) {
    const unsigned int neg_one = (unsigned int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(unsigned int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(unsigned int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to unsigned int" :
                    "value too large to convert to unsigned int");
            }
            return (unsigned int)-1;
        }
        return (unsigned int)val;
    }
    return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x);
}

static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) {
    const char neg_one = (char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to char" :
                    "value too large to convert to char");
            }
            return (char)-1;
        }
        return (char)val;
    }
    return (char)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) {
    const short neg_one = (short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to short" :
                    "value too large to convert to short");
            }
            return (short)-1;
        }
        return (short)val;
    }
    return (short)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) {
    const signed char neg_one = (signed char)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed char) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed char)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed char" :
                    "value too large to convert to signed char");
            }
            return (signed char)-1;
        }
        return (signed char)val;
    }
    return (signed char)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) {
    const signed short neg_one = (signed short)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed short) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed short)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed short" :
                    "value too large to convert to signed short");
            }
            return (signed short)-1;
        }
        return (signed short)val;
    }
    return (signed short)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) {
    const signed int neg_one = (signed int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(signed int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(signed int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to signed int" :
                    "value too large to convert to signed int");
            }
            return (signed int)-1;
        }
        return (signed int)val;
    }
    return (signed int)__Pyx_PyInt_AsSignedLong(x);
}

static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) {
    const int neg_one = (int)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (sizeof(int) < sizeof(long)) {
        long val = __Pyx_PyInt_AsLong(x);
        if (unlikely(val != (long)(int)val)) {
            if (!unlikely(val == -1 && PyErr_Occurred())) {
                PyErr_SetString(PyExc_OverflowError,
                    (is_unsigned && unlikely(val < 0)) ?
                    "can't convert negative value to int" :
                    "value too large to convert to int");
            }
            return (int)-1;
        }
        return (int)val;
    }
    return (int)__Pyx_PyInt_AsLong(x);
}

static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) {
    const unsigned long neg_one = (unsigned long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned long");
            return (unsigned long)-1;
        }
        return (unsigned long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned long");
                return (unsigned long)-1;
            }
            return (unsigned long)PyLong_AsUnsignedLong(x);
        } else {
            return (unsigned long)PyLong_AsLong(x);
        }
    } else {
        unsigned long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned long)-1;
        val = __Pyx_PyInt_AsUnsignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) {
    const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to unsigned PY_LONG_LONG");
            return (unsigned PY_LONG_LONG)-1;
        }
        return (unsigned PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to unsigned PY_LONG_LONG");
                return (unsigned PY_LONG_LONG)-1;
            }
            return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        unsigned PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (unsigned PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsUnsignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) {
    const long neg_one = (long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to long");
            return (long)-1;
        }
        return (long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to long");
                return (long)-1;
            }
            return (long)PyLong_AsUnsignedLong(x);
        } else {
            return (long)PyLong_AsLong(x);
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long)-1;
        val = __Pyx_PyInt_AsLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) {
    const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to PY_LONG_LONG");
            return (PY_LONG_LONG)-1;
        }
        return (PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to PY_LONG_LONG");
                return (PY_LONG_LONG)-1;
            }
            return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) {
    const signed long neg_one = (signed long)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed long");
            return (signed long)-1;
        }
        return (signed long)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed long");
                return (signed long)-1;
            }
            return (signed long)PyLong_AsUnsignedLong(x);
        } else {
            return (signed long)PyLong_AsLong(x);
        }
    } else {
        signed long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed long)-1;
        val = __Pyx_PyInt_AsSignedLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) {
    const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_VERSION_HEX < 0x03000000
    if (likely(PyInt_Check(x))) {
        long val = PyInt_AS_LONG(x);
        if (is_unsigned && unlikely(val < 0)) {
            PyErr_SetString(PyExc_OverflowError,
                            "can't convert negative value to signed PY_LONG_LONG");
            return (signed PY_LONG_LONG)-1;
        }
        return (signed PY_LONG_LONG)val;
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
            if (unlikely(Py_SIZE(x) < 0)) {
                PyErr_SetString(PyExc_OverflowError,
                                "can't convert negative value to signed PY_LONG_LONG");
                return (signed PY_LONG_LONG)-1;
            }
            return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x);
        } else {
            return (signed PY_LONG_LONG)PyLong_AsLongLong(x);
        }
    } else {
        signed PY_LONG_LONG val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (signed PY_LONG_LONG)-1;
        val = __Pyx_PyInt_AsSignedLongLong(tmp);
        Py_DECREF(tmp);
        return val;
    }
}

static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
}

static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        #if PY_VERSION_HEX < 0x02050000
        return PyErr_Warn(NULL, message);
        #else
        return PyErr_WarnEx(NULL, message, 1);
        #endif
    }
    return 0;
}

static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = (start + end) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,            /*int argcount,*/
        0,            /*int kwonlyargcount,*/
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,      /*int firstlineno,*/
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_globals = 0;
    PyFrameObject *py_frame = 0;
    py_code = __pyx_find_code_object(c_line ? c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
    }
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = py_line;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else  /* Python 3+ has unicode identifiers */
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}


/* Type Conversion Functions */

static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}

static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_VERSION_HEX < 0x03000000
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_VERSION_HEX < 0x03000000
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_VERSION_HEX < 0x03000000
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%s__ returned non-%s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}

static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject* x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}

static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
#if PY_VERSION_HEX < 0x02050000
   if (ival <= LONG_MAX)
       return PyInt_FromLong((long)ival);
   else {
       unsigned char *bytes = (unsigned char *) &ival;
       int one = 1; int little = (int)*(unsigned char*)&one;
       return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0);
   }
#else
   return PyInt_FromSize_t(ival);
#endif
}

static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) {
   unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x);
   if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) {
       return (size_t)-1;
   } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) {
       PyErr_SetString(PyExc_OverflowError,
                       "value too large to convert to size_t");
       return (size_t)-1;
   }
   return (size_t)val;
}


#endif /* Py_PYTHON_H */
