annotate Include/bitset.h @ 87690:66c1c9f32567 default tip

Add use_weakref option to functools.lru_cache The use_weakref option makes lru_cache create weak references to the function arguments when creating the cache key, which prevents them from staying in the memory forever even after all other references to them are gone. This is a proof of concept for http://bugs.python.org/issue19859
author Radomir Dopieralski <devel@sheep.art.pl>
date Tue, 03 Dec 2013 16:02:48 +0100
parents 6f6f965c5e2d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
145
853b736a6a9e Added copyright notice.
Guido van Rossum <guido@python.org>
parents: 6
diff changeset
1
13443
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
2 #ifndef Py_BITSET_H
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
3 #define Py_BITSET_H
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
4 #ifdef __cplusplus
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
5 extern "C" {
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
6 #endif
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
7
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
8 /* Bitset interface */
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
9
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
10 #define BYTE char
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
11
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
12 typedef BYTE *bitset;
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
13
13443
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
14 bitset newbitset(int nbits);
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
15 void delbitset(bitset bs);
2043
4ebee904924e Lots of small things, see ChangeLog
Guido van Rossum <guido@python.org>
parents: 1746
diff changeset
16 #define testbit(ss, ibit) (((ss)[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0)
13443
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
17 int addbit(bitset bs, int ibit); /* Returns 0 if already set */
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
18 int samebitset(bitset bs1, bitset bs2, int nbits);
7e58c060d534 ANSI-fication and Py_PROTO extermination.
Fred Drake <fdrake@acm.org>
parents: 13256
diff changeset
19 void mergebitset(bitset bs1, bitset bs2, int nbits);
6
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
20
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
21 #define BITSPERBYTE (8*sizeof(BYTE))
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
22 #define NBYTES(nbits) (((nbits) + BITSPERBYTE - 1) / BITSPERBYTE)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
23
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
24 #define BIT2BYTE(ibit) ((ibit) / BITSPERBYTE)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
25 #define BIT2SHIFT(ibit) ((ibit) % BITSPERBYTE)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
26 #define BIT2MASK(ibit) (1 << BIT2SHIFT(ibit))
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
27 #define BYTE2BIT(ibyte) ((ibyte) * BITSPERBYTE)
fc6fcd7df4f7 Initial revision
Guido van Rossum <guido@python.org>
parents:
diff changeset
28
1329
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
29 #ifdef __cplusplus
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
30 }
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
31 #endif
519c25039c6a * Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents: 1257
diff changeset
32 #endif /* !Py_BITSET_H */