/* Generated by Pyrex 0.9.8.5 on Thu Jan 13 22:04:36 2011 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "structmember.h"
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#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 PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)	PyInt_AsLong(o)
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
#endif
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#include <math.h>
#include "python-compat.h"


typedef struct {PyObject **p; int i; char *s; long n;} __Pyx_StringTabEntry; /*proto*/

static PyObject *__pyx_m;
static PyObject *__pyx_b;
static int __pyx_lineno;
static char *__pyx_filename;
static char **__pyx_f;

static char __pyx_mdoc[] = "Interface definition of a class like PySet but without caching the hash.\n\nThis is generally useful when you want to \'intern\' objects, etc. Note that this\ndiffers from Set in that we:\n  1) Don\'t have all of the .intersection, .difference, etc functions\n  2) Do return the object from the set via queries\n     eg. SimpleSet.add(key) => saved_key and SimpleSet[key] => saved_key\n\nDefinition of a class that is similar to Set with some small changes.";

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

static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/

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

static int __Pyx_ExportFunction(char *n, void *f, char *s); /*proto*/

static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/

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

static void __Pyx_AddTraceback(char *funcname); /*proto*/

/* Declarations from bzrlib._simple_set_pyx */

struct SimpleSetObject {
  PyObject_HEAD
  struct __pyx_vtabstruct_6bzrlib_15_simple_set_pyx_SimpleSet *__pyx_vtab;
  Py_ssize_t _used;
  Py_ssize_t _fill;
  Py_ssize_t _mask;
  PyObject **_table;
};

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) SimpleSet_Type;

struct __pyx_vtabstruct_6bzrlib_15_simple_set_pyx_SimpleSet {
  PyObject *(*_get)(struct SimpleSetObject *,PyObject *);
  PyObject *(*_add)(struct SimpleSetObject *,PyObject *);
  int (*_discard)(struct SimpleSetObject *,PyObject *);
  int (*_insert_clean)(struct SimpleSetObject *,PyObject *);
  Py_ssize_t (*_resize)(struct SimpleSetObject *,Py_ssize_t);
};
static struct __pyx_vtabstruct_6bzrlib_15_simple_set_pyx_SimpleSet *__pyx_vtabptr_6bzrlib_15_simple_set_pyx_SimpleSet;

static PyTypeObject *__pyx_ptype_6bzrlib_15_simple_set_pyx_SimpleSet = 0;
static struct SimpleSetObject *SimpleSet_New(void); /*proto*/
static PyObject *SimpleSet_Add(PyObject *,PyObject *); /*proto*/
static int SimpleSet_Contains(PyObject *,PyObject *); /*proto*/
static int SimpleSet_Discard(PyObject *,PyObject *); /*proto*/
static PyObject *SimpleSet_Get(struct SimpleSetObject *,PyObject *); /*proto*/
static Py_ssize_t SimpleSet_Size(PyObject *); /*proto*/
static int SimpleSet_Next(PyObject *,Py_ssize_t *,PyObject **); /*proto*/

/* Declarations from implementation of bzrlib._simple_set_pyx */

struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator {
  PyObject_HEAD
  Py_ssize_t pos;
  struct SimpleSetObject *set;
  Py_ssize_t _used;
  Py_ssize_t len;
};


static PyTypeObject *__pyx_ptype_6bzrlib_15_simple_set_pyx__SimpleSet_iterator = 0;
static PyObject *__pyx_v_6bzrlib_15_simple_set_pyx__dummy_obj;
static PyObject *__pyx_v_6bzrlib_15_simple_set_pyx__dummy;
static PyObject *__pyx_v_6bzrlib_15_simple_set_pyx__NotImplemented;
static int __pyx_f_6bzrlib_15_simple_set_pyx__is_equal(PyObject *,long,PyObject *); /*proto*/
static struct SimpleSetObject *__pyx_f_6bzrlib_15_simple_set_pyx__check_self(PyObject *); /*proto*/
static PyObject **__pyx_f_6bzrlib_15_simple_set_pyx__lookup(struct SimpleSetObject *,PyObject *); /*proto*/
static PyObject **_SimpleSet_Lookup(PyObject *,PyObject *); /*proto*/
static int __pyx_f_6bzrlib_15_simple_set_pyx_SimpleSet_traverse(struct SimpleSetObject *,visitproc,void *); /*proto*/

static char __pyx_k1[] = "<null>";
static char __pyx_k2[] = "<dummy>";
static char __pyx_k3[] = "Key %s is not present";
static char __pyx_k4[] = "ran out of slots.";
static char __pyx_k5[] = "Types added to SimpleSet must implement both tp_richcompare and tp_hash";
static char __pyx_k6[] = "Set size changed during iteration";
static char __pyx_k7[] = "self must not be None";
static char __pyx_k8[] = "should never get here";
static char __pyx_k9[] = "object";
static char __pyx_k10[] = "NotImplemented";

static PyObject *__pyx_n_NotImplemented;
static PyObject *__pyx_n_object;

static PyObject *__pyx_k1p;
static PyObject *__pyx_k2p;
static PyObject *__pyx_k3p;
static PyObject *__pyx_k4p;
static PyObject *__pyx_k5p;
static PyObject *__pyx_k6p;
static PyObject *__pyx_k7p;
static PyObject *__pyx_k8p;

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_n_NotImplemented, 1, __pyx_k10, sizeof(__pyx_k10)},
  {&__pyx_n_object, 1, __pyx_k9, sizeof(__pyx_k9)},
  {&__pyx_k1p, 0, __pyx_k1, sizeof(__pyx_k1)},
  {&__pyx_k2p, 0, __pyx_k2, sizeof(__pyx_k2)},
  {&__pyx_k3p, 0, __pyx_k3, sizeof(__pyx_k3)},
  {&__pyx_k4p, 0, __pyx_k4, sizeof(__pyx_k4)},
  {&__pyx_k5p, 0, __pyx_k5, sizeof(__pyx_k5)},
  {&__pyx_k6p, 0, __pyx_k6, sizeof(__pyx_k6)},
  {&__pyx_k7p, 0, __pyx_k7, sizeof(__pyx_k7)},
  {&__pyx_k8p, 0, __pyx_k8, sizeof(__pyx_k8)},
  {0, 0, 0, 0}
};



/* Implementation of bzrlib._simple_set_pyx */

static int __pyx_f_6bzrlib_15_simple_set_pyx__is_equal(PyObject *__pyx_v_this,long __pyx_v_this_hash,PyObject *__pyx_v_other) {
  long __pyx_v_other_hash;
  PyObject *__pyx_v_res;
  int __pyx_r;
  int __pyx_1;
  long __pyx_2;
  PyObject *__pyx_3 = 0;
  __pyx_v_res = Py_None; Py_INCREF(Py_None);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":65 */
  __pyx_1 = (__pyx_v_this == __pyx_v_other);
  if (__pyx_1) {
    __pyx_r = 1;
    goto __pyx_L0;
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":67 */
  __pyx_2 = PyObject_Hash(__pyx_v_other); if (__pyx_2 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; goto __pyx_L1;}
  __pyx_v_other_hash = __pyx_2;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":68 */
  __pyx_1 = (__pyx_v_other_hash != __pyx_v_this_hash);
  if (__pyx_1) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":78 */
  __pyx_3 = Py_TYPE(__pyx_v_this)->tp_richcompare(__pyx_v_this,__pyx_v_other,Py_EQ); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; goto __pyx_L1;}
  Py_DECREF(__pyx_v_res);
  __pyx_v_res = __pyx_3;
  __pyx_3 = 0;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":79 */
  __pyx_1 = __pyx_v_res == __pyx_v_6bzrlib_15_simple_set_pyx__NotImplemented;
  if (__pyx_1) {

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":80 */
    __pyx_3 = Py_TYPE(__pyx_v_other)->tp_richcompare(__pyx_v_other,__pyx_v_this,Py_EQ); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; goto __pyx_L1;}
    Py_DECREF(__pyx_v_res);
    __pyx_v_res = __pyx_3;
    __pyx_3 = 0;

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":81 */
    __pyx_1 = __pyx_v_res == __pyx_v_6bzrlib_15_simple_set_pyx__NotImplemented;
    if (__pyx_1) {
      __pyx_r = 0;
      goto __pyx_L0;
      goto __pyx_L5;
    }
    __pyx_L5:;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":83 */
  __pyx_1 = PyObject_IsTrue(__pyx_v_res); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; goto __pyx_L1;}
  if (__pyx_1) {
    __pyx_r = 1;
    goto __pyx_L0;
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":85 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx._is_equal");
  __pyx_r = (-1);
  __pyx_L0:;
  Py_DECREF(__pyx_v_res);
  return __pyx_r;
}

static int __pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  Py_ssize_t __pyx_v_size;
  Py_ssize_t __pyx_v_n_bytes;
  int __pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  static char *__pyx_argnames[] = {0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return -1;
  Py_INCREF(__pyx_v_self);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":108 */
  __pyx_v_size = 1024;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":109 */
  ((struct SimpleSetObject *)__pyx_v_self)->_mask = (__pyx_v_size - 1);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":110 */
  ((struct SimpleSetObject *)__pyx_v_self)->_used = 0;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":111 */
  ((struct SimpleSetObject *)__pyx_v_self)->_fill = 0;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":112 */
  __pyx_v_n_bytes = ((sizeof(PyObject *)) * __pyx_v_size);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":113 */
  ((struct SimpleSetObject *)__pyx_v_self)->_table = ((PyObject **)PyMem_Malloc(__pyx_v_n_bytes));

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":114 */
  __pyx_1 = (((struct SimpleSetObject *)__pyx_v_self)->_table == NULL);
  if (__pyx_1) {
    __pyx_2 = PyObject_CallObject(PyExc_MemoryError, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L1;}
    __Pyx_Raise(__pyx_2, 0, 0);
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":116 */
  memset(((struct SimpleSetObject *)__pyx_v_self)->_table,0,__pyx_v_n_bytes);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx.SimpleSet.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet___sizeof__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet___sizeof__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  static char *__pyx_argnames[] = {0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
  Py_INCREF(__pyx_v_self);
  __pyx_1 = PyInt_FromSsize_t((((((sizeof(PyObject)) + (sizeof(void *))) + (3 * (sizeof(Py_ssize_t)))) + (sizeof(PyObject **))) + ((((struct SimpleSetObject *)__pyx_v_self)->_mask + 1) * (sizeof(PyObject *))))); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx.SimpleSet.__sizeof__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static void __pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet___dealloc__(PyObject *__pyx_v_self) {
  int __pyx_1;
  Py_INCREF(__pyx_v_self);
  __pyx_1 = (((struct SimpleSetObject *)__pyx_v_self)->_table != NULL);
  if (__pyx_1) {

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":134 */
    PyMem_Free(((struct SimpleSetObject *)__pyx_v_self)->_table);

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":135 */
    ((struct SimpleSetObject *)__pyx_v_self)->_table = NULL;
    goto __pyx_L2;
  }
  __pyx_L2:;

  Py_DECREF(__pyx_v_self);
}

static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet_4used___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet_4used___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  Py_INCREF(__pyx_v_self);
  __pyx_1 = PyInt_FromSsize_t(((struct SimpleSetObject *)__pyx_v_self)->_used); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx.SimpleSet.used.__get__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet_4fill___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet_4fill___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  Py_INCREF(__pyx_v_self);
  __pyx_1 = PyInt_FromSsize_t(((struct SimpleSetObject *)__pyx_v_self)->_fill); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx.SimpleSet.fill.__get__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet_4mask___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet_4mask___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  Py_INCREF(__pyx_v_self);
  __pyx_1 = PyInt_FromSsize_t(((struct SimpleSetObject *)__pyx_v_self)->_mask); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx.SimpleSet.mask.__get__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet__memory_size(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6bzrlib_15_simple_set_pyx_9SimpleSet__memory_size[] = "Return the number of bytes of memory consumed by this class.";
static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet__memory_size(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  static char *__pyx_argnames[] = {0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
  Py_INCREF(__pyx_v_self);
  __pyx_1 = PyInt_FromSsize_t(((sizeof(__pyx_v_self)) + ((sizeof(PyObject *)) * (((struct SimpleSetObject *)__pyx_v_self)->_mask + 1)))); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx.SimpleSet._memory_size");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static Py_ssize_t __pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet___len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet___len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  Py_INCREF(__pyx_v_self);
  __pyx_r = ((struct SimpleSetObject *)__pyx_v_self)->_used;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet__test_lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet__test_lookup(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject **__pyx_v_slot;
  PyObject *__pyx_v_res;
  PyObject *__pyx_r;
  PyObject **__pyx_1;
  int __pyx_2;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  static char *__pyx_argnames[] = {"key",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_key)) return 0;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_key);
  __pyx_v_res = Py_None; Py_INCREF(Py_None);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":159 */
  __pyx_1 = __pyx_f_6bzrlib_15_simple_set_pyx__lookup(((struct SimpleSetObject *)__pyx_v_self),__pyx_v_key); if (__pyx_1 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; goto __pyx_L1;}
  __pyx_v_slot = __pyx_1;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":160 */
  __pyx_2 = ((__pyx_v_slot[0]) == NULL);
  if (__pyx_2) {
    Py_INCREF(__pyx_k1p);
    Py_DECREF(__pyx_v_res);
    __pyx_v_res = __pyx_k1p;
    goto __pyx_L2;
  }
  __pyx_2 = ((__pyx_v_slot[0]) == __pyx_v_6bzrlib_15_simple_set_pyx__dummy);
  if (__pyx_2) {
    Py_INCREF(__pyx_k2p);
    Py_DECREF(__pyx_v_res);
    __pyx_v_res = __pyx_k2p;
    goto __pyx_L2;
  }
  /*else*/ {
    Py_INCREF(((PyObject *)(__pyx_v_slot[0])));
    Py_DECREF(__pyx_v_res);
    __pyx_v_res = ((PyObject *)(__pyx_v_slot[0]));
  }
  __pyx_L2:;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":166 */
  __pyx_3 = PyInt_FromLong(((int)(__pyx_v_slot - ((struct SimpleSetObject *)__pyx_v_self)->_table))); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; goto __pyx_L1;}
  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
  Py_INCREF(__pyx_v_res);
  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_v_res);
  __pyx_3 = 0;
  __pyx_r = __pyx_4;
  __pyx_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx.SimpleSet._test_lookup");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_res);
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_key);
  return __pyx_r;
}

static int __pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet___contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static int __pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet___contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject **__pyx_v_slot;
  int __pyx_r;
  PyObject **__pyx_1;
  int __pyx_2;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_key);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":172 */
  __pyx_1 = __pyx_f_6bzrlib_15_simple_set_pyx__lookup(((struct SimpleSetObject *)__pyx_v_self),__pyx_v_key); if (__pyx_1 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; goto __pyx_L1;}
  __pyx_v_slot = __pyx_1;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":173 */
  __pyx_2 = ((__pyx_v_slot[0]) == NULL);
  if (!__pyx_2) {
    __pyx_2 = ((__pyx_v_slot[0]) == __pyx_v_6bzrlib_15_simple_set_pyx__dummy);
  }
  if (__pyx_2) {
    __pyx_2 = PyInt_AsLong(Py_False); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; goto __pyx_L1;}
    __pyx_r = __pyx_2;
    goto __pyx_L0;
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":175 */
  __pyx_2 = PyInt_AsLong(Py_True); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; goto __pyx_L1;}
  __pyx_r = __pyx_2;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("bzrlib._simple_set_pyx.SimpleSet.__contains__");
  __pyx_r = -1;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_key);
  return __pyx_r;
}

static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet__get(struct SimpleSetObject *__pyx_v_self,PyObject *__pyx_v_key) {
  PyObject **__pyx_v_slot;
  PyObject *__pyx_r;
  PyObject **__pyx_1;
  int __pyx_2;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_key);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":181 */
  __pyx_1 = __pyx_f_6bzrlib_15_simple_set_pyx__lookup(__pyx_v_self,__pyx_v_key); if (__pyx_1 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; goto __pyx_L1;}
  __pyx_v_slot = __pyx_1;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":182 */
  __pyx_2 = ((__pyx_v_slot[0]) == NULL);
  if (!__pyx_2) {
    __pyx_2 = ((__pyx_v_slot[0]) == __pyx_v_6bzrlib_15_simple_set_pyx__dummy);
  }
  if (__pyx_2) {
    __pyx_r = NULL;
    goto __pyx_L0;
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":184 */
  __pyx_r = (__pyx_v_slot[0]);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("bzrlib._simple_set_pyx.SimpleSet._get");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_key);
  return __pyx_r;
}

static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_v_py_val;
  PyObject *__pyx_v_val;
  PyObject *__pyx_r;
  PyObject *__pyx_1;
  int __pyx_2;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_key);
  __pyx_v_val = Py_None; Py_INCREF(Py_None);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":190 */
  __pyx_1 = ((struct __pyx_vtabstruct_6bzrlib_15_simple_set_pyx_SimpleSet *)((struct SimpleSetObject *)__pyx_v_self)->__pyx_vtab)->_get(((struct SimpleSetObject *)__pyx_v_self),__pyx_v_key); if (__pyx_1 == NULL && PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; goto __pyx_L1;}
  __pyx_v_py_val = __pyx_1;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":191 */
  __pyx_2 = (__pyx_v_py_val == NULL);
  if (__pyx_2) {
    __pyx_3 = PyNumber_Remainder(__pyx_k3p, __pyx_v_key); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_3 = PyObject_CallObject(PyExc_KeyError, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":193 */
  Py_INCREF(((PyObject *)__pyx_v_py_val));
  Py_DECREF(__pyx_v_val);
  __pyx_v_val = ((PyObject *)__pyx_v_py_val);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":194 */
  Py_INCREF(__pyx_v_val);
  __pyx_r = __pyx_v_val;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx.SimpleSet.__getitem__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_val);
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_key);
  return __pyx_r;
}

static int __pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet__insert_clean(struct SimpleSetObject *__pyx_v_self,PyObject *__pyx_v_key) {
  size_t __pyx_v_i;
  size_t __pyx_v_n_lookup;
  long __pyx_v_the_hash;
  PyObject **__pyx_v_table;
  PyObject **__pyx_v_slot;
  Py_ssize_t __pyx_v_mask;
  int __pyx_r;
  long __pyx_1;
  size_t __pyx_2;
  int __pyx_3;
  PyObject *__pyx_4 = 0;
  PyObject *__pyx_5 = 0;
  Py_INCREF(__pyx_v_self);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":208 */
  __pyx_v_mask = __pyx_v_self->_mask;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":209 */
  __pyx_v_table = __pyx_v_self->_table;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":211 */
  __pyx_1 = PyObject_Hash(__pyx_v_key); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; goto __pyx_L1;}
  __pyx_v_the_hash = __pyx_1;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":212 */
  __pyx_v_i = __pyx_v_the_hash;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":213 */
  __pyx_2 = __pyx_v_mask;
  for (__pyx_v_n_lookup = 0; __pyx_v_n_lookup <= __pyx_2; ++__pyx_v_n_lookup) {

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":214 */
    __pyx_v_slot = (&(__pyx_v_table[(__pyx_v_i & __pyx_v_mask)]));

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":215 */
    __pyx_3 = ((__pyx_v_slot[0]) == NULL);
    if (__pyx_3) {

      /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":216 */
      (__pyx_v_slot[0]) = __pyx_v_key;

      /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":217 */
      __pyx_v_self->_fill = (__pyx_v_self->_fill + 1);

      /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":218 */
      __pyx_v_self->_used = (__pyx_v_self->_used + 1);

      /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":219 */
      __pyx_r = 1;
      goto __pyx_L0;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":220 */
    __pyx_v_i = ((__pyx_v_i + 1) + __pyx_v_n_lookup);
  }

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":221 */
  __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; goto __pyx_L1;}
  Py_INCREF(__pyx_k4p);
  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k4p);
  __pyx_5 = PyObject_CallObject(PyExc_RuntimeError, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; goto __pyx_L1;}
  Py_DECREF(__pyx_4); __pyx_4 = 0;
  __Pyx_Raise(__pyx_5, 0, 0);
  Py_DECREF(__pyx_5); __pyx_5 = 0;
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; goto __pyx_L1;}

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_4);
  Py_XDECREF(__pyx_5);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx.SimpleSet._insert_clean");
  __pyx_r = (-1);
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet__py_resize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6bzrlib_15_simple_set_pyx_9SimpleSet__py_resize[] = "Do not use this directly, it is only exposed for testing.";
static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet__py_resize(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_min_used = 0;
  PyObject *__pyx_r;
  Py_ssize_t __pyx_1;
  Py_ssize_t __pyx_2;
  PyObject *__pyx_3 = 0;
  static char *__pyx_argnames[] = {"min_used",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_min_used)) return 0;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_min_used);
  __pyx_1 = PyInt_AsSsize_t(__pyx_v_min_used); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;}
  __pyx_2 = ((struct __pyx_vtabstruct_6bzrlib_15_simple_set_pyx_SimpleSet *)((struct SimpleSetObject *)__pyx_v_self)->__pyx_vtab)->_resize(((struct SimpleSetObject *)__pyx_v_self),__pyx_1); if (__pyx_2 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;}
  __pyx_3 = PyInt_FromSsize_t(__pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;}
  __pyx_r = __pyx_3;
  __pyx_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx.SimpleSet._py_resize");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_min_used);
  return __pyx_r;
}

static Py_ssize_t __pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet__resize(struct SimpleSetObject *__pyx_v_self,Py_ssize_t __pyx_v_min_used) {
  Py_ssize_t __pyx_v_new_size;
  Py_ssize_t __pyx_v_n_bytes;
  Py_ssize_t __pyx_v_remaining;
  PyObject **__pyx_v_new_table;
  PyObject **__pyx_v_old_table;
  PyObject **__pyx_v_slot;
  Py_ssize_t __pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  Py_INCREF(__pyx_v_self);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":239 */
  __pyx_v_new_size = 1024;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":240 */
  while (1) {
    __pyx_1 = (__pyx_v_new_size <= __pyx_v_min_used);
    if (__pyx_1) {
      __pyx_1 = (__pyx_v_new_size > 0);
    }
    if (!__pyx_1) break;
    __pyx_v_new_size = (__pyx_v_new_size << 1);
  }

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":243 */
  __pyx_1 = (__pyx_v_new_size <= 0);
  if (__pyx_1) {
    __pyx_2 = PyObject_CallObject(PyExc_MemoryError, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; goto __pyx_L1;}
    __Pyx_Raise(__pyx_2, 0, 0);
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; goto __pyx_L1;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":252 */
  __pyx_v_n_bytes = ((sizeof(PyObject *)) * __pyx_v_new_size);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":253 */
  __pyx_v_new_table = ((PyObject **)PyMem_Malloc(__pyx_v_n_bytes));

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":254 */
  __pyx_1 = (__pyx_v_new_table == NULL);
  if (__pyx_1) {
    __pyx_2 = PyObject_CallObject(PyExc_MemoryError, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; goto __pyx_L1;}
    __Pyx_Raise(__pyx_2, 0, 0);
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; goto __pyx_L1;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":257 */
  __pyx_v_old_table = __pyx_v_self->_table;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":258 */
  __pyx_v_self->_table = __pyx_v_new_table;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":259 */
  memset(__pyx_v_self->_table,0,__pyx_v_n_bytes);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":260 */
  __pyx_v_self->_mask = (__pyx_v_new_size - 1);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":261 */
  __pyx_v_self->_used = 0;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":262 */
  __pyx_v_remaining = __pyx_v_self->_fill;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":263 */
  __pyx_v_self->_fill = 0;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":267 */
  __pyx_v_slot = __pyx_v_old_table;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":268 */
  while (1) {
    __pyx_1 = (__pyx_v_remaining > 0);
    if (!__pyx_1) break;

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":269 */
    __pyx_1 = ((__pyx_v_slot[0]) == NULL);
    if (__pyx_1) {
      goto __pyx_L8;
    }
    __pyx_1 = ((__pyx_v_slot[0]) == __pyx_v_6bzrlib_15_simple_set_pyx__dummy);
    if (__pyx_1) {
      __pyx_v_remaining = (__pyx_v_remaining - 1);
      goto __pyx_L8;
    }
    /*else*/ {

      /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":274 */
      __pyx_v_remaining = (__pyx_v_remaining - 1);

      /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":275 */
      __pyx_1 = ((struct __pyx_vtabstruct_6bzrlib_15_simple_set_pyx_SimpleSet *)__pyx_v_self->__pyx_vtab)->_insert_clean(__pyx_v_self,(__pyx_v_slot[0])); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; goto __pyx_L1;}
    }
    __pyx_L8:;

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":276 */
    __pyx_v_slot = (__pyx_v_slot + 1);
  }

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":277 */
  PyMem_Free(__pyx_v_old_table);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":278 */
  __pyx_r = __pyx_v_new_size;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx.SimpleSet._resize");
  __pyx_r = (-1);
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet_add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6bzrlib_15_simple_set_pyx_9SimpleSet_add[] = "Similar to set.add(), start tracking this key.\n        \n        There is one small difference, which is that we return the object that\n        is stored at the given location. (which is closer to the\n        dict.setdefault() functionality.)\n        ";
static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet_add(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  static char *__pyx_argnames[] = {"key",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_key)) return 0;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_key);
  __pyx_1 = ((struct __pyx_vtabstruct_6bzrlib_15_simple_set_pyx_SimpleSet *)((struct SimpleSetObject *)__pyx_v_self)->__pyx_vtab)->_add(((struct SimpleSetObject *)__pyx_v_self),__pyx_v_key); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx.SimpleSet.add");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_key);
  return __pyx_r;
}

static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet__add(struct SimpleSetObject *__pyx_v_self,PyObject *__pyx_v_key) {
  PyObject **__pyx_v_slot;
  PyObject *__pyx_v_py_key;
  int __pyx_v_added;
  PyObject *__pyx_v_retval;
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject **__pyx_4;
  Py_ssize_t __pyx_5;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_key);
  __pyx_v_retval = Py_None; Py_INCREF(Py_None);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":293 */
  __pyx_v_py_key = ((PyObject *)__pyx_v_key);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":294 */
  __pyx_1 = (Py_TYPE(__pyx_v_py_key)->tp_richcompare == NULL);
  if (!__pyx_1) {
    __pyx_1 = (Py_TYPE(__pyx_v_py_key)->tp_hash == NULL);
  }
  if (__pyx_1) {
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; goto __pyx_L1;}
    Py_INCREF(__pyx_k5p);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k5p);
    __pyx_3 = PyObject_CallObject(PyExc_TypeError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":298 */
  __pyx_v_added = 0;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":300 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  if (!(__pyx_v_self->_used < __pyx_v_self->_mask)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; goto __pyx_L1;}
  }
  #endif

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":301 */
  __pyx_4 = __pyx_f_6bzrlib_15_simple_set_pyx__lookup(__pyx_v_self,__pyx_v_key); if (__pyx_4 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; goto __pyx_L1;}
  __pyx_v_slot = __pyx_4;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":302 */
  __pyx_1 = ((__pyx_v_slot[0]) == NULL);
  if (__pyx_1) {

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":303 */
    Py_INCREF(__pyx_v_py_key);

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":304 */
    __pyx_v_self->_fill = (__pyx_v_self->_fill + 1);

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":305 */
    __pyx_v_self->_used = (__pyx_v_self->_used + 1);

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":306 */
    (__pyx_v_slot[0]) = __pyx_v_py_key;

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":307 */
    __pyx_v_added = 1;
    goto __pyx_L3;
  }
  __pyx_1 = ((__pyx_v_slot[0]) == __pyx_v_6bzrlib_15_simple_set_pyx__dummy);
  if (__pyx_1) {

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":309 */
    Py_INCREF(__pyx_v_py_key);

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":310 */
    __pyx_v_self->_used = (__pyx_v_self->_used + 1);

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":311 */
    (__pyx_v_slot[0]) = __pyx_v_py_key;

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":312 */
    __pyx_v_added = 1;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":315 */
  Py_INCREF(((PyObject *)(__pyx_v_slot[0])));
  Py_DECREF(__pyx_v_retval);
  __pyx_v_retval = ((PyObject *)(__pyx_v_slot[0]));

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":317 */
  __pyx_1 = __pyx_v_added;
  if (__pyx_1) {
    __pyx_1 = ((__pyx_v_self->_fill * 3) >= ((__pyx_v_self->_mask + 1) * 2));
  }
  if (__pyx_1) {
    __pyx_5 = ((struct __pyx_vtabstruct_6bzrlib_15_simple_set_pyx_SimpleSet *)__pyx_v_self->__pyx_vtab)->_resize(__pyx_v_self,(__pyx_v_self->_used * 2)); if (__pyx_5 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; goto __pyx_L1;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":323 */
  Py_INCREF(__pyx_v_retval);
  __pyx_r = __pyx_v_retval;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx.SimpleSet._add");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_retval);
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_key);
  return __pyx_r;
}

static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet_discard(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6bzrlib_15_simple_set_pyx_9SimpleSet_discard[] = "Remove key from the set, whether it exists or not.\n\n        :return: False if the item did not exist, True if it did\n        ";
static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet_discard(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_key = 0;
  PyObject *__pyx_r;
  int __pyx_1;
  static char *__pyx_argnames[] = {"key",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_key)) return 0;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_key);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":330 */
  __pyx_1 = ((struct __pyx_vtabstruct_6bzrlib_15_simple_set_pyx_SimpleSet *)((struct SimpleSetObject *)__pyx_v_self)->__pyx_vtab)->_discard(((struct SimpleSetObject *)__pyx_v_self),__pyx_v_key); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; goto __pyx_L1;}
  if (__pyx_1) {
    Py_INCREF(Py_True);
    __pyx_r = Py_True;
    goto __pyx_L0;
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":332 */
  Py_INCREF(Py_False);
  __pyx_r = Py_False;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("bzrlib._simple_set_pyx.SimpleSet.discard");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_key);
  return __pyx_r;
}

static int __pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet__discard(struct SimpleSetObject *__pyx_v_self,PyObject *__pyx_v_key) {
  PyObject **__pyx_v_slot;
  int __pyx_r;
  PyObject **__pyx_1;
  int __pyx_2;
  Py_ssize_t __pyx_3;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_key);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":337 */
  __pyx_1 = __pyx_f_6bzrlib_15_simple_set_pyx__lookup(__pyx_v_self,__pyx_v_key); if (__pyx_1 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; goto __pyx_L1;}
  __pyx_v_slot = __pyx_1;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":338 */
  __pyx_2 = ((__pyx_v_slot[0]) == NULL);
  if (!__pyx_2) {
    __pyx_2 = ((__pyx_v_slot[0]) == __pyx_v_6bzrlib_15_simple_set_pyx__dummy);
  }
  if (__pyx_2) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":340 */
  __pyx_v_self->_used = (__pyx_v_self->_used - 1);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":341 */
  Py_DECREF((__pyx_v_slot[0]));

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":342 */
  (__pyx_v_slot[0]) = __pyx_v_6bzrlib_15_simple_set_pyx__dummy;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":353 */
  __pyx_2 = (((__pyx_v_self->_fill - __pyx_v_self->_used) * 5) > __pyx_v_self->_mask);
  if (__pyx_2) {
    __pyx_3 = ((struct __pyx_vtabstruct_6bzrlib_15_simple_set_pyx_SimpleSet *)__pyx_v_self->__pyx_vtab)->_resize(__pyx_v_self,(__pyx_v_self->_used * 2)); if (__pyx_3 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; goto __pyx_L1;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":355 */
  __pyx_r = 1;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("bzrlib._simple_set_pyx.SimpleSet._discard");
  __pyx_r = (-1);
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_key);
  return __pyx_r;
}

static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet___iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet___iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  Py_INCREF(__pyx_v_self);
  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; goto __pyx_L1;}
  Py_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_self);
  __pyx_2 = PyObject_CallObject(((PyObject *)__pyx_ptype_6bzrlib_15_simple_set_pyx__SimpleSet_iterator), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_r = __pyx_2;
  __pyx_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx.SimpleSet.__iter__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static int __pyx_f_6bzrlib_15_simple_set_pyx_19_SimpleSet_iterator___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_6bzrlib_15_simple_set_pyx_19_SimpleSet_iterator___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_obj = 0;
  int __pyx_r;
  static char *__pyx_argnames[] = {"obj",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_obj)) return -1;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_obj);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":370 */
  if (!__Pyx_TypeTest(__pyx_v_obj, __pyx_ptype_6bzrlib_15_simple_set_pyx_SimpleSet)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; goto __pyx_L1;}
  Py_INCREF(__pyx_v_obj);
  Py_DECREF(((PyObject *)((struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *)__pyx_v_self)->set));
  ((struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *)__pyx_v_self)->set = ((struct SimpleSetObject *)__pyx_v_obj);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":371 */
  ((struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *)__pyx_v_self)->pos = 0;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":372 */
  ((struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *)__pyx_v_self)->_used = ((struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *)__pyx_v_self)->set->_used;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":373 */
  ((struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *)__pyx_v_self)->len = ((struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *)__pyx_v_self)->set->_used;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("bzrlib._simple_set_pyx._SimpleSet_iterator.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_obj);
  return __pyx_r;
}

static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_19_SimpleSet_iterator___iter__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_19_SimpleSet_iterator___iter__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_self);
  __pyx_r = __pyx_v_self;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_19_SimpleSet_iterator___next__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_19_SimpleSet_iterator___next__(PyObject *__pyx_v_self) {
  PyObject *__pyx_v_key;
  PyObject *__pyx_v_the_key;
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  int __pyx_4;
  Py_INCREF(__pyx_v_self);
  __pyx_v_the_key = Py_None; Py_INCREF(Py_None);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":382 */
  __pyx_1 = ((PyObject *)((struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *)__pyx_v_self)->set) == Py_None;
  if (__pyx_1) {
    __Pyx_Raise(PyExc_StopIteration, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":384 */
  __pyx_1 = (((struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *)__pyx_v_self)->set->_used != ((struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *)__pyx_v_self)->_used);
  if (__pyx_1) {

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":386 */
    ((struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *)__pyx_v_self)->_used = (-1);

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":387 */
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; goto __pyx_L1;}
    Py_INCREF(__pyx_k6p);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k6p);
    __pyx_3 = PyObject_CallObject(PyExc_RuntimeError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; goto __pyx_L1;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":388 */
  __pyx_1 = SimpleSet_Next(((PyObject *)((struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *)__pyx_v_self)->set),(&((struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *)__pyx_v_self)->pos),(&__pyx_v_key)); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}
  __pyx_4 = (!__pyx_1);
  if (__pyx_4) {

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":389 */
    Py_INCREF(Py_None);
    Py_DECREF(((PyObject *)((struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *)__pyx_v_self)->set));
    ((struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *)__pyx_v_self)->set = ((struct SimpleSetObject *)Py_None);

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":390 */
    __Pyx_Raise(PyExc_StopIteration, 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; goto __pyx_L1;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":392 */
  Py_INCREF(((PyObject *)__pyx_v_key));
  Py_DECREF(__pyx_v_the_key);
  __pyx_v_the_key = ((PyObject *)__pyx_v_key);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":393 */
  ((struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *)__pyx_v_self)->len = (((struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *)__pyx_v_self)->len - 1);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":394 */
  Py_INCREF(__pyx_v_the_key);
  __pyx_r = __pyx_v_the_key;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx._SimpleSet_iterator.__next__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_the_key);
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_19_SimpleSet_iterator___length_hint__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6bzrlib_15_simple_set_pyx_19_SimpleSet_iterator___length_hint__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  static char *__pyx_argnames[] = {0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
  Py_INCREF(__pyx_v_self);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":397 */
  __pyx_1 = ((PyObject *)((struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *)__pyx_v_self)->set) != Py_None;
  if (__pyx_1) {
    __pyx_1 = (((struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *)__pyx_v_self)->_used == ((struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *)__pyx_v_self)->set->_used);
  }
  if (__pyx_1) {
    __pyx_2 = PyInt_FromSsize_t(((struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *)__pyx_v_self)->len); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; goto __pyx_L1;}
    __pyx_r = __pyx_2;
    __pyx_2 = 0;
    goto __pyx_L0;
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":399 */
  __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; goto __pyx_L1;}
  __pyx_r = __pyx_2;
  __pyx_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx._SimpleSet_iterator.__length_hint__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static struct SimpleSetObject *SimpleSet_New(void) {
  struct SimpleSetObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  __pyx_1 = PyObject_CallObject(((PyObject *)__pyx_ptype_6bzrlib_15_simple_set_pyx_SimpleSet), 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; goto __pyx_L1;}
  __pyx_r = ((struct SimpleSetObject *)__pyx_1);
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = ((struct SimpleSetObject *)Py_None); Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx.SimpleSet_New");
  __pyx_r = 0;
  __pyx_L0:;
  return __pyx_r;
}

static struct SimpleSetObject *__pyx_f_6bzrlib_15_simple_set_pyx__check_self(PyObject *__pyx_v_self) {
  struct SimpleSetObject *__pyx_v_true_self;
  struct SimpleSetObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  Py_INCREF(__pyx_v_self);
  __pyx_v_true_self = ((struct SimpleSetObject *)Py_None); Py_INCREF(Py_None);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":417 */
  __pyx_1 = __pyx_v_self == Py_None;
  if (__pyx_1) {
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; goto __pyx_L1;}
    Py_INCREF(__pyx_k7p);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k7p);
    __pyx_3 = PyObject_CallObject(PyExc_TypeError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":419 */
  if (!__Pyx_TypeTest(__pyx_v_self, __pyx_ptype_6bzrlib_15_simple_set_pyx_SimpleSet)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; goto __pyx_L1;}
  Py_INCREF(__pyx_v_self);
  Py_DECREF(((PyObject *)__pyx_v_true_self));
  __pyx_v_true_self = ((struct SimpleSetObject *)__pyx_v_self);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":420 */
  Py_INCREF(((PyObject *)__pyx_v_true_self));
  __pyx_r = __pyx_v_true_self;
  goto __pyx_L0;

  __pyx_r = ((struct SimpleSetObject *)Py_None); Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx._check_self");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_true_self);
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject **__pyx_f_6bzrlib_15_simple_set_pyx__lookup(struct SimpleSetObject *__pyx_v_self,PyObject *__pyx_v_key) {
  size_t __pyx_v_i;
  size_t __pyx_v_n_lookup;
  Py_ssize_t __pyx_v_mask;
  long __pyx_v_key_hash;
  PyObject **__pyx_v_table;
  PyObject **__pyx_v_slot;
  PyObject *__pyx_v_cur;
  PyObject **__pyx_v_free_slot;
  PyObject *__pyx_v_py_key;
  PyObject **__pyx_r;
  long __pyx_1;
  size_t __pyx_2;
  int __pyx_3;
  PyObject *__pyx_4 = 0;
  PyObject *__pyx_5 = 0;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_key);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":464 */
  __pyx_v_py_key = ((PyObject *)__pyx_v_key);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":467 */
  __pyx_1 = PyObject_Hash(__pyx_v_py_key); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; goto __pyx_L1;}
  __pyx_v_key_hash = __pyx_1;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":468 */
  __pyx_v_i = __pyx_v_key_hash;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":469 */
  __pyx_v_mask = __pyx_v_self->_mask;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":470 */
  __pyx_v_table = __pyx_v_self->_table;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":471 */
  __pyx_v_free_slot = NULL;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":472 */
  __pyx_2 = __pyx_v_mask;
  for (__pyx_v_n_lookup = 0; __pyx_v_n_lookup <= __pyx_2; ++__pyx_v_n_lookup) {

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":473 */
    __pyx_v_slot = (&(__pyx_v_table[(__pyx_v_i & __pyx_v_mask)]));

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":474 */
    __pyx_v_cur = (__pyx_v_slot[0]);

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":475 */
    __pyx_3 = (__pyx_v_cur == NULL);
    if (__pyx_3) {
      __pyx_3 = (__pyx_v_free_slot != NULL);
      if (__pyx_3) {
        __pyx_r = __pyx_v_free_slot;
        goto __pyx_L0;
        goto __pyx_L5;
      }
      /*else*/ {
        __pyx_r = __pyx_v_slot;
        goto __pyx_L0;
      }
      __pyx_L5:;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":482 */
    __pyx_3 = (__pyx_v_cur == __pyx_v_py_key);
    if (__pyx_3) {
      __pyx_r = __pyx_v_slot;
      goto __pyx_L0;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":485 */
    __pyx_3 = (__pyx_v_cur == __pyx_v_6bzrlib_15_simple_set_pyx__dummy);
    if (__pyx_3) {
      __pyx_3 = (__pyx_v_free_slot == NULL);
      if (__pyx_3) {
        __pyx_v_free_slot = __pyx_v_slot;
        goto __pyx_L8;
      }
      __pyx_L8:;
      goto __pyx_L7;
    }
    __pyx_3 = __pyx_f_6bzrlib_15_simple_set_pyx__is_equal(__pyx_v_py_key,__pyx_v_key_hash,__pyx_v_cur); if (__pyx_3 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; goto __pyx_L1;}
    if (__pyx_3) {
      __pyx_r = __pyx_v_slot;
      goto __pyx_L0;
      goto __pyx_L7;
    }
    __pyx_L7:;

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":491 */
    __pyx_v_i = ((__pyx_v_i + 1) + __pyx_v_n_lookup);
  }

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":492 */
  __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; goto __pyx_L1;}
  Py_INCREF(__pyx_k8p);
  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k8p);
  __pyx_5 = PyObject_CallObject(PyExc_AssertionError, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; goto __pyx_L1;}
  Py_DECREF(__pyx_4); __pyx_4 = 0;
  __Pyx_Raise(__pyx_5, 0, 0);
  Py_DECREF(__pyx_5); __pyx_5 = 0;
  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; goto __pyx_L1;}

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_4);
  Py_XDECREF(__pyx_5);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx._lookup");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_key);
  return __pyx_r;
}

static PyObject **_SimpleSet_Lookup(PyObject *__pyx_v_self,PyObject *__pyx_v_key) {
  PyObject **__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject **__pyx_2;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_key);
  __pyx_1 = ((PyObject *)__pyx_f_6bzrlib_15_simple_set_pyx__check_self(__pyx_v_self)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; goto __pyx_L1;}
  __pyx_2 = __pyx_f_6bzrlib_15_simple_set_pyx__lookup(((struct SimpleSetObject *)__pyx_1),__pyx_v_key); if (__pyx_2 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_r = __pyx_2;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx._SimpleSet_Lookup");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_key);
  return __pyx_r;
}

static PyObject *SimpleSet_Add(PyObject *__pyx_v_self,PyObject *__pyx_v_key) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_key);
  __pyx_1 = ((PyObject *)__pyx_f_6bzrlib_15_simple_set_pyx__check_self(__pyx_v_self)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; goto __pyx_L1;}
  __pyx_2 = ((struct __pyx_vtabstruct_6bzrlib_15_simple_set_pyx_SimpleSet *)((struct SimpleSetObject *)__pyx_1)->__pyx_vtab)->_add(((struct SimpleSetObject *)__pyx_1),__pyx_v_key); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_r = __pyx_2;
  __pyx_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx.SimpleSet_Add");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_key);
  return __pyx_r;
}

static int SimpleSet_Contains(PyObject *__pyx_v_self,PyObject *__pyx_v_key) {
  int __pyx_r;
  PyObject *__pyx_1 = 0;
  int __pyx_2;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_key);
  __pyx_1 = ((PyObject *)__pyx_f_6bzrlib_15_simple_set_pyx__check_self(__pyx_v_self)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; goto __pyx_L1;}
  __pyx_2 = PySequence_Contains(__pyx_1, __pyx_v_key); if (__pyx_2 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_r = __pyx_2;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx.SimpleSet_Contains");
  __pyx_r = (-1);
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_key);
  return __pyx_r;
}

static int SimpleSet_Discard(PyObject *__pyx_v_self,PyObject *__pyx_v_key) {
  int __pyx_r;
  PyObject *__pyx_1 = 0;
  int __pyx_2;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_key);
  __pyx_1 = ((PyObject *)__pyx_f_6bzrlib_15_simple_set_pyx__check_self(__pyx_v_self)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; goto __pyx_L1;}
  __pyx_2 = ((struct __pyx_vtabstruct_6bzrlib_15_simple_set_pyx_SimpleSet *)((struct SimpleSetObject *)__pyx_1)->__pyx_vtab)->_discard(((struct SimpleSetObject *)__pyx_1),__pyx_v_key); if (__pyx_2 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_r = __pyx_2;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx.SimpleSet_Discard");
  __pyx_r = (-1);
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_key);
  return __pyx_r;
}

static PyObject *SimpleSet_Get(struct SimpleSetObject *__pyx_v_self,PyObject *__pyx_v_key) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_key);
  __pyx_1 = ((PyObject *)__pyx_f_6bzrlib_15_simple_set_pyx__check_self(((PyObject *)__pyx_v_self))); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}
  __pyx_2 = ((struct __pyx_vtabstruct_6bzrlib_15_simple_set_pyx_SimpleSet *)((struct SimpleSetObject *)__pyx_1)->__pyx_vtab)->_get(((struct SimpleSetObject *)__pyx_1),__pyx_v_key); if (__pyx_2 == NULL && PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_r = __pyx_2;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx.SimpleSet_Get");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_key);
  return __pyx_r;
}

static Py_ssize_t SimpleSet_Size(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  PyObject *__pyx_1 = 0;
  Py_INCREF(__pyx_v_self);
  __pyx_1 = ((PyObject *)__pyx_f_6bzrlib_15_simple_set_pyx__check_self(__pyx_v_self)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; goto __pyx_L1;}
  __pyx_r = ((struct SimpleSetObject *)__pyx_1)->_used;
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx.SimpleSet_Size");
  __pyx_r = (-1);
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static int SimpleSet_Next(PyObject *__pyx_v_self,Py_ssize_t *__pyx_v_pos,PyObject **__pyx_v_key) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_mask;
  struct SimpleSetObject *__pyx_v_true_self;
  PyObject **__pyx_v_table;
  int __pyx_r;
  PyObject *__pyx_1 = 0;
  int __pyx_2;
  Py_INCREF(__pyx_v_self);
  __pyx_v_true_self = ((struct SimpleSetObject *)Py_None); Py_INCREF(Py_None);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":569 */
  __pyx_1 = ((PyObject *)__pyx_f_6bzrlib_15_simple_set_pyx__check_self(__pyx_v_self)); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; goto __pyx_L1;}
  Py_DECREF(((PyObject *)__pyx_v_true_self));
  __pyx_v_true_self = ((struct SimpleSetObject *)__pyx_1);
  __pyx_1 = 0;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":570 */
  __pyx_v_i = (__pyx_v_pos[0]);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":571 */
  __pyx_2 = (__pyx_v_i < 0);
  if (__pyx_2) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":573 */
  __pyx_v_mask = __pyx_v_true_self->_mask;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":574 */
  __pyx_v_table = __pyx_v_true_self->_table;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":575 */
  while (1) {
    __pyx_2 = (__pyx_v_i <= __pyx_v_mask);
    if (__pyx_2) {
      __pyx_2 = ((__pyx_v_table[__pyx_v_i]) == NULL);
      if (!__pyx_2) {
        __pyx_2 = ((__pyx_v_table[__pyx_v_i]) == __pyx_v_6bzrlib_15_simple_set_pyx__dummy);
      }
    }
    if (!__pyx_2) break;
    __pyx_v_i = (__pyx_v_i + 1);
  }

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":577 */
  (__pyx_v_pos[0]) = (__pyx_v_i + 1);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":578 */
  __pyx_2 = (__pyx_v_i > __pyx_v_mask);
  if (__pyx_2) {
    __pyx_r = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":580 */
  __pyx_2 = (__pyx_v_key != NULL);
  if (__pyx_2) {
    (__pyx_v_key[0]) = (__pyx_v_table[__pyx_v_i]);
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":582 */
  __pyx_r = 1;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx.SimpleSet_Next");
  __pyx_r = (-1);
  __pyx_L0:;
  Py_DECREF(__pyx_v_true_self);
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static int __pyx_f_6bzrlib_15_simple_set_pyx_SimpleSet_traverse(struct SimpleSetObject *__pyx_v_self,visitproc __pyx_v_visit,void *__pyx_v_arg) {
  Py_ssize_t __pyx_v_pos;
  PyObject *__pyx_v_next_key;
  int __pyx_v_ret;
  int __pyx_r;
  int __pyx_1;
  Py_INCREF(__pyx_v_self);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":597 */
  __pyx_v_pos = 0;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":598 */
  while (1) {
    __pyx_1 = SimpleSet_Next(((PyObject *)__pyx_v_self),(&__pyx_v_pos),(&__pyx_v_next_key)); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; goto __pyx_L1;}
    if (!__pyx_1) break;

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":599 */
    __pyx_v_ret = __pyx_v_visit(__pyx_v_next_key,__pyx_v_arg);

    /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":600 */
    __pyx_1 = __pyx_v_ret;
    if (__pyx_1) {
      __pyx_r = __pyx_v_ret;
      goto __pyx_L0;
      goto __pyx_L4;
    }
    __pyx_L4:;
  }

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":602 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("bzrlib._simple_set_pyx.SimpleSet_traverse");
  __pyx_r = (-1);
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}
static struct __pyx_vtabstruct_6bzrlib_15_simple_set_pyx_SimpleSet __pyx_vtable_6bzrlib_15_simple_set_pyx_SimpleSet;

static PyObject *__pyx_tp_new_6bzrlib_15_simple_set_pyx_SimpleSet(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct SimpleSetObject *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct SimpleSetObject *)o);
  *(struct __pyx_vtabstruct_6bzrlib_15_simple_set_pyx_SimpleSet **)&p->__pyx_vtab = __pyx_vtabptr_6bzrlib_15_simple_set_pyx_SimpleSet;
  return o;
}

static void __pyx_tp_dealloc_6bzrlib_15_simple_set_pyx_SimpleSet(PyObject *o) {
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++o->ob_refcnt;
    __pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet___dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --o->ob_refcnt;
    PyErr_Restore(etype, eval, etb);
  }
  (*o->ob_type->tp_free)(o);
}
static PyObject *__pyx_sq_item_6bzrlib_15_simple_set_pyx_SimpleSet(PyObject *o, Py_ssize_t i) {
  PyObject *r;
  PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0;
  r = o->ob_type->tp_as_mapping->mp_subscript(o, x);
  Py_DECREF(x);
  return r;
}

static PyObject *__pyx_getprop_6bzrlib_15_simple_set_pyx_9SimpleSet_used(PyObject *o, void *x) {
  return __pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet_4used___get__(o);
}

static PyObject *__pyx_getprop_6bzrlib_15_simple_set_pyx_9SimpleSet_fill(PyObject *o, void *x) {
  return __pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet_4fill___get__(o);
}

static PyObject *__pyx_getprop_6bzrlib_15_simple_set_pyx_9SimpleSet_mask(PyObject *o, void *x) {
  return __pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet_4mask___get__(o);
}

static struct PyMethodDef __pyx_methods_6bzrlib_15_simple_set_pyx_SimpleSet[] = {
  {"__sizeof__", (PyCFunction)__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet___sizeof__, METH_VARARGS|METH_KEYWORDS, 0},
  {"_memory_size", (PyCFunction)__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet__memory_size, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6bzrlib_15_simple_set_pyx_9SimpleSet__memory_size},
  {"_test_lookup", (PyCFunction)__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet__test_lookup, METH_VARARGS|METH_KEYWORDS, 0},
  {"_py_resize", (PyCFunction)__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet__py_resize, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6bzrlib_15_simple_set_pyx_9SimpleSet__py_resize},
  {"add", (PyCFunction)__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet_add, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6bzrlib_15_simple_set_pyx_9SimpleSet_add},
  {"discard", (PyCFunction)__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet_discard, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6bzrlib_15_simple_set_pyx_9SimpleSet_discard},
  {0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_6bzrlib_15_simple_set_pyx_SimpleSet[] = {
  {"used", __pyx_getprop_6bzrlib_15_simple_set_pyx_9SimpleSet_used, 0, 0, 0},
  {"fill", __pyx_getprop_6bzrlib_15_simple_set_pyx_9SimpleSet_fill, 0, 0, 0},
  {"mask", __pyx_getprop_6bzrlib_15_simple_set_pyx_9SimpleSet_mask, 0, 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_SimpleSet = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_divide*/
  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*/
  0, /*nb_coerce*/
  0, /*nb_int*/
  0, /*nb_long*/
  0, /*nb_float*/
  0, /*nb_oct*/
  0, /*nb_hex*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_divide*/
  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_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
  0, /*nb_index*/
  #endif
};

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

static PyMappingMethods __pyx_tp_as_mapping_SimpleSet = {
  __pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet___len__, /*mp_length*/
  __pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet___getitem__, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_SimpleSet = {
  0, /*bf_getreadbuffer*/
  0, /*bf_getwritebuffer*/
  0, /*bf_getsegcount*/
  0, /*bf_getcharbuffer*/
};

DL_EXPORT(PyTypeObject) SimpleSet_Type = {
  PyObject_HEAD_INIT(0)
  0, /*ob_size*/
  "bzrlib._simple_set_pyx.SimpleSet", /*tp_name*/
  sizeof(struct SimpleSetObject), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6bzrlib_15_simple_set_pyx_SimpleSet, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_SimpleSet, /*tp_as_number*/
  &__pyx_tp_as_sequence_SimpleSet, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_SimpleSet, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_SimpleSet, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "This class can be used to track canonical forms for objects.\n\n    It is similar in function to the interned dictionary that is used by\n    strings. However:\n\n      1) It assumes that hash(obj) is cheap, so does not need to inline a copy\n         of it\n      2) It only stores one reference to the object, rather than 2 (key vs\n         key:value)\n\n    As such, it uses 1/3rd the amount of memory to store a pointer to the\n    interned object.\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet___iter__, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_6bzrlib_15_simple_set_pyx_SimpleSet, /*tp_methods*/
  0, /*tp_members*/
  __pyx_getsets_6bzrlib_15_simple_set_pyx_SimpleSet, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6bzrlib_15_simple_set_pyx_SimpleSet, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
};

static PyObject *__pyx_tp_new_6bzrlib_15_simple_set_pyx__SimpleSet_iterator(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *)o);
  p->set = ((struct SimpleSetObject *)Py_None); Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_6bzrlib_15_simple_set_pyx__SimpleSet_iterator(PyObject *o) {
  struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *p = (struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *)o;
  Py_XDECREF(((PyObject *)p->set));
  (*o->ob_type->tp_free)(o);
}

static int __pyx_tp_traverse_6bzrlib_15_simple_set_pyx__SimpleSet_iterator(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *p = (struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *)o;
  if (p->set) {
    e = (*v)(((PyObject*)p->set), a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_6bzrlib_15_simple_set_pyx__SimpleSet_iterator(PyObject *o) {
  struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *p = (struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator *)o;
  PyObject *t;
  t = ((PyObject *)p->set); 
  p->set = ((struct SimpleSetObject *)Py_None); Py_INCREF(Py_None);
  Py_XDECREF(t);
  return 0;
}

static struct PyMethodDef __pyx_methods_6bzrlib_15_simple_set_pyx__SimpleSet_iterator[] = {
  {"__length_hint__", (PyCFunction)__pyx_f_6bzrlib_15_simple_set_pyx_19_SimpleSet_iterator___length_hint__, METH_VARARGS|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number__SimpleSet_iterator = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_divide*/
  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*/
  0, /*nb_coerce*/
  0, /*nb_int*/
  0, /*nb_long*/
  0, /*nb_float*/
  0, /*nb_oct*/
  0, /*nb_hex*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_divide*/
  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_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence__SimpleSet_iterator = {
  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__SimpleSet_iterator = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer__SimpleSet_iterator = {
  0, /*bf_getreadbuffer*/
  0, /*bf_getwritebuffer*/
  0, /*bf_getsegcount*/
  0, /*bf_getcharbuffer*/
};

PyTypeObject __pyx_type_6bzrlib_15_simple_set_pyx__SimpleSet_iterator = {
  PyObject_HEAD_INIT(0)
  0, /*ob_size*/
  "bzrlib._simple_set_pyx._SimpleSet_iterator", /*tp_name*/
  sizeof(struct __pyx_obj_6bzrlib_15_simple_set_pyx__SimpleSet_iterator), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_6bzrlib_15_simple_set_pyx__SimpleSet_iterator, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number__SimpleSet_iterator, /*tp_as_number*/
  &__pyx_tp_as_sequence__SimpleSet_iterator, /*tp_as_sequence*/
  &__pyx_tp_as_mapping__SimpleSet_iterator, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer__SimpleSet_iterator, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "Iterator over the SimpleSet structure.", /*tp_doc*/
  __pyx_tp_traverse_6bzrlib_15_simple_set_pyx__SimpleSet_iterator, /*tp_traverse*/
  __pyx_tp_clear_6bzrlib_15_simple_set_pyx__SimpleSet_iterator, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  __pyx_f_6bzrlib_15_simple_set_pyx_19_SimpleSet_iterator___iter__, /*tp_iter*/
  __pyx_f_6bzrlib_15_simple_set_pyx_19_SimpleSet_iterator___next__, /*tp_iternext*/
  __pyx_methods_6bzrlib_15_simple_set_pyx__SimpleSet_iterator, /*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_f_6bzrlib_15_simple_set_pyx_19_SimpleSet_iterator___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_6bzrlib_15_simple_set_pyx__SimpleSet_iterator, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
};

static struct PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

static void __pyx_init_filenames(void); /*proto*/

PyMODINIT_FUNC init_simple_set_pyx(void); /*proto*/
PyMODINIT_FUNC init_simple_set_pyx(void) {
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  __pyx_init_filenames();
  __pyx_m = Py_InitModule4("_simple_set_pyx", __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VERSION);
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;};
  Py_INCREF(__pyx_m);
  __pyx_b = PyImport_AddModule("__builtin__");
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;};
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;};
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;};
  __pyx_v_6bzrlib_15_simple_set_pyx__dummy_obj = Py_None; Py_INCREF(Py_None);
  __pyx_v_6bzrlib_15_simple_set_pyx__NotImplemented = Py_None; Py_INCREF(Py_None);
  if (__Pyx_ExportFunction("SimpleSet_New", (void*)SimpleSet_New, "struct SimpleSetObject *(void)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;}
  if (__Pyx_ExportFunction("SimpleSet_Add", (void*)SimpleSet_Add, "PyObject *(PyObject *,PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;}
  if (__Pyx_ExportFunction("SimpleSet_Contains", (void*)SimpleSet_Contains, "int (PyObject *,PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;}
  if (__Pyx_ExportFunction("SimpleSet_Discard", (void*)SimpleSet_Discard, "int (PyObject *,PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;}
  if (__Pyx_ExportFunction("SimpleSet_Get", (void*)SimpleSet_Get, "PyObject *(struct SimpleSetObject *,PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;}
  if (__Pyx_ExportFunction("SimpleSet_Size", (void*)SimpleSet_Size, "Py_ssize_t (PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;}
  if (__Pyx_ExportFunction("SimpleSet_Next", (void*)SimpleSet_Next, "int (PyObject *,Py_ssize_t *,PyObject **)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;}
  if (__Pyx_ExportFunction("_SimpleSet_Lookup", (void*)_SimpleSet_Lookup, "PyObject **(PyObject *,PyObject *)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;}
  __pyx_vtabptr_6bzrlib_15_simple_set_pyx_SimpleSet = &__pyx_vtable_6bzrlib_15_simple_set_pyx_SimpleSet;
  *(void(**)(void))&__pyx_vtable_6bzrlib_15_simple_set_pyx_SimpleSet._get = (void(*)(void))__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet__get;
  *(void(**)(void))&__pyx_vtable_6bzrlib_15_simple_set_pyx_SimpleSet._add = (void(*)(void))__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet__add;
  *(void(**)(void))&__pyx_vtable_6bzrlib_15_simple_set_pyx_SimpleSet._discard = (void(*)(void))__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet__discard;
  *(void(**)(void))&__pyx_vtable_6bzrlib_15_simple_set_pyx_SimpleSet._insert_clean = (void(*)(void))__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet__insert_clean;
  *(void(**)(void))&__pyx_vtable_6bzrlib_15_simple_set_pyx_SimpleSet._resize = (void(*)(void))__pyx_f_6bzrlib_15_simple_set_pyx_9SimpleSet__resize;
  if (PyType_Ready(&SimpleSet_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
  if (__Pyx_SetVtable(SimpleSet_Type.tp_dict, __pyx_vtabptr_6bzrlib_15_simple_set_pyx_SimpleSet) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
  if (PyObject_SetAttrString(__pyx_m, "SimpleSet", (PyObject *)&SimpleSet_Type) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
  __pyx_ptype_6bzrlib_15_simple_set_pyx_SimpleSet = &SimpleSet_Type;
  __pyx_type_6bzrlib_15_simple_set_pyx__SimpleSet_iterator.tp_free = _PyObject_GC_Del;
  if (PyType_Ready(&__pyx_type_6bzrlib_15_simple_set_pyx__SimpleSet_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; goto __pyx_L1;}
  if (PyObject_SetAttrString(__pyx_m, "_SimpleSet_iterator", (PyObject *)&__pyx_type_6bzrlib_15_simple_set_pyx__SimpleSet_iterator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; goto __pyx_L1;}
  __pyx_ptype_6bzrlib_15_simple_set_pyx__SimpleSet_iterator = &__pyx_type_6bzrlib_15_simple_set_pyx__SimpleSet_iterator;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":54 */
  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_object); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_v_6bzrlib_15_simple_set_pyx__dummy_obj);
  __pyx_v_6bzrlib_15_simple_set_pyx__dummy_obj = __pyx_2;
  __pyx_2 = 0;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":55 */
  __pyx_v_6bzrlib_15_simple_set_pyx__dummy = ((PyObject *)__pyx_v_6bzrlib_15_simple_set_pyx__dummy_obj);

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":59 */
  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_NotImplemented); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
  Py_DECREF(__pyx_v_6bzrlib_15_simple_set_pyx__NotImplemented);
  __pyx_v_6bzrlib_15_simple_set_pyx__NotImplemented = __pyx_1;
  __pyx_1 = 0;

  /* "/home/vila/src/bzr/integration/2.3b5-dev/bzrlib/_simple_set_pyx.pyx":606 */
  ((PyTypeObject *)__pyx_ptype_6bzrlib_15_simple_set_pyx_SimpleSet)->tp_traverse = ((traverseproc)__pyx_f_6bzrlib_15_simple_set_pyx_SimpleSet_traverse);
  return;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("bzrlib._simple_set_pyx");
}

static char *__pyx_filenames[] = {
  "_simple_set_pyx.pyx",
};

/* Runtime support code */

static void __pyx_init_filenames(void) {
  __pyx_f = __pyx_filenames;
}

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
    Py_XINCREF(type);
    Py_XINCREF(value);
    Py_XINCREF(tb);
    /* First, check the traceback argument, replacing None with NULL. */
    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;
    }
    /* Next, replace a missing value with None */
    if (value == NULL) {
        value = Py_None;
        Py_INCREF(value);
    }
    #if PY_VERSION_HEX < 0x02050000
    if (!PyClass_Check(type))
    #else
    if (!PyType_Check(type))
    #endif
    {
        /* Raising an instance.  The value should be a dummy. */
        if (value != Py_None) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        /* Normalize to raise <class>, <instance> */
        Py_DECREF(value);
        value = type;
        #if PY_VERSION_HEX < 0x02050000
            if (PyInstance_Check(type)) {
                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
                Py_INCREF(type);
            }
            else {
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception must be an old-style class or instance");
                goto raise_error;
            }
        #else
            type = (PyObject*) type->ob_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
    }
    PyErr_Restore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}

static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (obj == Py_None || PyObject_TypeCheck(obj, type))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s",
        obj->ob_type->tp_name, type->tp_name);
    return 0;
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        if (!*t->p)
            return -1;
        if (t->i)
            PyString_InternInPlace(t->p);
        ++t;
    }
    return 0;
}

static int __Pyx_ExportFunction(char *n, void *f, char *s) {
    PyObject *d = 0;
    PyObject *p = 0;
    d = PyObject_GetAttrString(__pyx_m, "__pyx_capi__");
    if (!d) {
        PyErr_Clear();
        d = PyDict_New();
        if (!d)
            goto bad;
        Py_INCREF(d);
        if (PyModule_AddObject(__pyx_m, "__pyx_capi__", d) < 0)
            goto bad;
    }
    p = PyCObject_FromVoidPtrAndDesc(f, s, 0);
    if (!p)
        goto bad;
    if (PyDict_SetItemString(d, n, p) < 0)
        goto bad;
    Py_DECREF(d);
    return 0;
bad:
    Py_XDECREF(p);
    Py_XDECREF(d);
    return -1;
}

static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
    PyObject *pycobj = 0;
    int result;
    
    pycobj = PyCObject_FromVoidPtr(vtable, 0);
    if (!pycobj)
        goto bad;
    if (PyDict_SetItemString(dict, "__pyx_vtable__", pycobj) < 0)
        goto bad;
    result = 0;
    goto done;

bad:
    result = -1;
done:
    Py_XDECREF(pycobj);
    return result;
}

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

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"

static void __Pyx_AddTraceback(char *funcname) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyObject *py_globals = 0;
    PyObject *empty_tuple = 0;
    PyObject *empty_string = 0;
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    
    py_srcfile = PyString_FromString(__pyx_filename);
    if (!py_srcfile) goto bad;
    py_funcname = PyString_FromString(funcname);
    if (!py_funcname) goto bad;
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    empty_tuple = PyTuple_New(0);
    if (!empty_tuple) goto bad;
    empty_string = PyString_FromString("");
    if (!empty_string) goto bad;
    py_code = PyCode_New(
        0,            /*int argcount,*/
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        empty_string, /*PyObject *code,*/
        empty_tuple,  /*PyObject *consts,*/
        empty_tuple,  /*PyObject *names,*/
        empty_tuple,  /*PyObject *varnames,*/
        empty_tuple,  /*PyObject *freevars,*/
        empty_tuple,  /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        __pyx_lineno,   /*int firstlineno,*/
        empty_string  /*PyObject *lnotab*/
    );
    if (!py_code) 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 = __pyx_lineno;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    Py_XDECREF(empty_tuple);
    Py_XDECREF(empty_string);
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}
