blob: 51d8d187c7657263ace79571d52d81d969c23550 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
reed@android.com8a1c16f2008-12-17 15:59:43 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * Copyright 2006 The Android Open Source Project
reed@android.com8a1c16f2008-12-17 15:59:43 +00004 *
epoger@google.comec3ed6a2011-07-28 14:26:00 +00005 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
reed@android.com8a1c16f2008-12-17 15:59:43 +00007 */
8
epoger@google.comec3ed6a2011-07-28 14:26:00 +00009
reed@android.com8a1c16f2008-12-17 15:59:43 +000010#ifndef SkTypes_DEFINED
11#define SkTypes_DEFINED
12
13#include "SkPreConfig.h"
14#include "SkUserConfig.h"
15#include "SkPostConfig.h"
16
17#ifndef SK_IGNORE_STDINT_DOT_H
18 #include <stdint.h>
19#endif
20
21#include <stdio.h>
22
23/** \file SkTypes.h
24*/
25
reed@android.com9aa8b322010-04-13 13:22:54 +000026/** See SkGraphics::GetVersion() to retrieve these at runtime
27 */
28#define SKIA_VERSION_MAJOR 1
29#define SKIA_VERSION_MINOR 0
30#define SKIA_VERSION_PATCH 0
31
reed@android.com8a1c16f2008-12-17 15:59:43 +000032/*
33 memory wrappers to be implemented by the porting layer (platform)
34*/
35
36/** Called internally if we run out of memory. The platform implementation must
37 not return, but should either throw an exception or otherwise exit.
38*/
reed@google.comde916c82011-10-19 19:50:48 +000039SK_API extern void sk_out_of_memory(void);
reed@android.com8a1c16f2008-12-17 15:59:43 +000040/** Called internally if we hit an unrecoverable error.
41 The platform implementation must not return, but should either throw
42 an exception or otherwise exit.
43*/
reed@google.comde916c82011-10-19 19:50:48 +000044SK_API extern void sk_throw(void);
reed@android.com8a1c16f2008-12-17 15:59:43 +000045
46enum {
47 SK_MALLOC_TEMP = 0x01, //!< hint to sk_malloc that the requested memory will be freed in the scope of the stack frame
48 SK_MALLOC_THROW = 0x02 //!< instructs sk_malloc to call sk_throw if the memory cannot be allocated.
49};
50/** Return a block of memory (at least 4-byte aligned) of at least the
51 specified size. If the requested memory cannot be returned, either
52 return null (if SK_MALLOC_TEMP bit is clear) or call sk_throw()
53 (if SK_MALLOC_TEMP bit is set). To free the memory, call sk_free().
54*/
ctguil@chromium.org7ffb1b22011-03-15 21:27:08 +000055SK_API extern void* sk_malloc_flags(size_t size, unsigned flags);
reed@android.com8a1c16f2008-12-17 15:59:43 +000056/** Same as sk_malloc(), but hard coded to pass SK_MALLOC_THROW as the flag
57*/
reed@google.comde916c82011-10-19 19:50:48 +000058SK_API extern void* sk_malloc_throw(size_t size);
reed@android.com8a1c16f2008-12-17 15:59:43 +000059/** Same as standard realloc(), but this one never returns null on failure. It will throw
60 an exception if it fails.
61*/
reed@google.comde916c82011-10-19 19:50:48 +000062SK_API extern void* sk_realloc_throw(void* buffer, size_t size);
reed@android.com8a1c16f2008-12-17 15:59:43 +000063/** Free memory returned by sk_malloc(). It is safe to pass null.
64*/
reed@google.comde916c82011-10-19 19:50:48 +000065SK_API extern void sk_free(void*);
reed@android.com8a1c16f2008-12-17 15:59:43 +000066
reed@android.com4516f472009-06-29 16:25:36 +000067// bzero is safer than memset, but we can't rely on it, so... sk_bzero()
68static inline void sk_bzero(void* buffer, size_t size) {
69 memset(buffer, 0, size);
70}
71
reed@google.combdf73612011-09-06 14:56:20 +000072///////////////////////////////////////////////////////////////////////////////
73
74#ifdef SK_OVERRIDE_GLOBAL_NEW
75#include <new>
76
77inline void* operator new(size_t size) {
78 return sk_malloc_throw(size);
79}
80
81inline void operator delete(void* p) {
82 sk_free(p);
83}
84#endif
85
86///////////////////////////////////////////////////////////////////////////////
reed@android.com8a1c16f2008-12-17 15:59:43 +000087
88#define SK_INIT_TO_AVOID_WARNING = 0
89
90#ifndef SkDebugf
91 void SkDebugf(const char format[], ...);
92#endif
93
94#ifdef SK_DEBUG
95 #define SkASSERT(cond) SK_DEBUGBREAK(cond)
96 #define SkDEBUGCODE(code) code
97 #define SkDECLAREPARAM(type, var) , type var
98 #define SkPARAM(var) , var
99// #define SkDEBUGF(args ) SkDebugf##args
100 #define SkDEBUGF(args ) SkDebugf args
101 #define SkAssertResult(cond) SkASSERT(cond)
102#else
103 #define SkASSERT(cond)
104 #define SkDEBUGCODE(code)
105 #define SkDEBUGF(args)
106 #define SkDECLAREPARAM(type, var)
107 #define SkPARAM(var)
108
109 // unlike SkASSERT, this guy executes its condition in the non-debug build
110 #define SkAssertResult(cond) cond
111#endif
112
vandebo@chromium.org28be72b2010-11-11 21:37:00 +0000113namespace {
114
115template <bool>
116struct SkCompileAssert {
117};
118
119} // namespace
120
121#define SK_COMPILE_ASSERT(expr, msg) \
122 typedef SkCompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
123
reed@android.com8a1c16f2008-12-17 15:59:43 +0000124///////////////////////////////////////////////////////////////////////
125
reed@google.com37a31332011-01-25 14:55:42 +0000126/**
127 * Fast type for signed 8 bits. Use for parameter passing and local variables,
128 * not for storage.
129 */
130typedef int S8CPU;
reed@android.com8a1c16f2008-12-17 15:59:43 +0000131
reed@google.com37a31332011-01-25 14:55:42 +0000132/**
133 * Fast type for unsigned 8 bits. Use for parameter passing and local
134 * variables, not for storage
135 */
136typedef unsigned U8CPU;
137
138/**
139 * Fast type for signed 16 bits. Use for parameter passing and local variables,
140 * not for storage
141 */
142typedef int S16CPU;
143
144/**
145 * Fast type for unsigned 16 bits. Use for parameter passing and local
146 * variables, not for storage
147 */
148typedef unsigned U16CPU;
149
150/**
151 * Meant to be faster than bool (doesn't promise to be 0 or 1,
152 * just 0 or non-zero
153 */
154typedef int SkBool;
155
156/**
157 * Meant to be a small version of bool, for storage purposes. Will be 0 or 1
158 */
159typedef uint8_t SkBool8;
reed@android.com8a1c16f2008-12-17 15:59:43 +0000160
161#ifdef SK_DEBUG
ctguil@chromium.org7ffb1b22011-03-15 21:27:08 +0000162 SK_API int8_t SkToS8(long);
163 SK_API uint8_t SkToU8(size_t);
164 SK_API int16_t SkToS16(long);
165 SK_API uint16_t SkToU16(size_t);
166 SK_API int32_t SkToS32(long);
167 SK_API uint32_t SkToU32(size_t);
reed@android.com8a1c16f2008-12-17 15:59:43 +0000168#else
169 #define SkToS8(x) ((int8_t)(x))
170 #define SkToU8(x) ((uint8_t)(x))
171 #define SkToS16(x) ((int16_t)(x))
172 #define SkToU16(x) ((uint16_t)(x))
173 #define SkToS32(x) ((int32_t)(x))
174 #define SkToU32(x) ((uint32_t)(x))
175#endif
176
177/** Returns 0 or 1 based on the condition
178*/
179#define SkToBool(cond) ((cond) != 0)
180
181#define SK_MaxS16 32767
182#define SK_MinS16 -32767
183#define SK_MaxU16 0xFFFF
184#define SK_MinU16 0
185#define SK_MaxS32 0x7FFFFFFF
186#define SK_MinS32 0x80000001
187#define SK_MaxU32 0xFFFFFFFF
188#define SK_MinU32 0
189#define SK_NaN32 0x80000000
190
reed@android.comd4577752009-11-21 02:48:11 +0000191/** Returns true if the value can be represented with signed 16bits
192 */
reed@android.com90209ca2009-11-21 19:58:04 +0000193static inline bool SkIsS16(long x) {
reed@android.comd4577752009-11-21 02:48:11 +0000194 return (int16_t)x == x;
195}
196
197/** Returns true if the value can be represented with unsigned 16bits
198 */
reed@android.com90209ca2009-11-21 19:58:04 +0000199static inline bool SkIsU16(long x) {
reed@android.comd4577752009-11-21 02:48:11 +0000200 return (uint16_t)x == x;
201}
202
203//////////////////////////////////////////////////////////////////////////////
reed@android.com8a1c16f2008-12-17 15:59:43 +0000204#ifndef SK_OFFSETOF
205 #define SK_OFFSETOF(type, field) ((char*)&(((type*)1)->field) - (char*)1)
206#endif
207
208/** Returns the number of entries in an array (not a pointer)
209*/
210#define SK_ARRAY_COUNT(array) (sizeof(array) / sizeof(array[0]))
211
212/** Returns x rounded up to a multiple of 2
213*/
214#define SkAlign2(x) (((x) + 1) >> 1 << 1)
215/** Returns x rounded up to a multiple of 4
216*/
217#define SkAlign4(x) (((x) + 3) >> 2 << 2)
218
tomhudson@google.com01224d52011-11-28 18:22:01 +0000219#define SkIsAlign4(x) (((x) & 3) == 0)
220
reed@android.com8a1c16f2008-12-17 15:59:43 +0000221typedef uint32_t SkFourByteTag;
222#define SkSetFourByteTag(a, b, c, d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d))
223
224/** 32 bit integer to hold a unicode value
225*/
226typedef int32_t SkUnichar;
227/** 32 bit value to hold a millisecond count
228*/
229typedef uint32_t SkMSec;
230/** 1 second measured in milliseconds
231*/
232#define SK_MSec1 1000
233/** maximum representable milliseconds
234*/
235#define SK_MSecMax 0x7FFFFFFF
236/** Returns a < b for milliseconds, correctly handling wrap-around from 0xFFFFFFFF to 0
237*/
238#define SkMSec_LT(a, b) ((int32_t)(a) - (int32_t)(b) < 0)
239/** Returns a <= b for milliseconds, correctly handling wrap-around from 0xFFFFFFFF to 0
240*/
241#define SkMSec_LE(a, b) ((int32_t)(a) - (int32_t)(b) <= 0)
242
reed@android.com8a1c16f2008-12-17 15:59:43 +0000243/****************************************************************************
244 The rest of these only build with C++
245*/
246#ifdef __cplusplus
247
248/** Faster than SkToBool for integral conditions. Returns 0 or 1
249*/
reed@android.comd4577752009-11-21 02:48:11 +0000250static inline int Sk32ToBool(uint32_t n) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000251 return (n | (0-n)) >> 31;
252}
253
reed@android.comd4577752009-11-21 02:48:11 +0000254template <typename T> inline void SkTSwap(T& a, T& b) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000255 T c(a);
256 a = b;
257 b = c;
258}
259
reed@android.comd4577752009-11-21 02:48:11 +0000260static inline int32_t SkAbs32(int32_t value) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000261#ifdef SK_CPU_HAS_CONDITIONAL_INSTR
262 if (value < 0)
263 value = -value;
264 return value;
265#else
266 int32_t mask = value >> 31;
267 return (value ^ mask) - mask;
268#endif
269}
270
reed@android.comd4577752009-11-21 02:48:11 +0000271static inline int32_t SkMax32(int32_t a, int32_t b) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000272 if (a < b)
273 a = b;
274 return a;
275}
276
reed@android.comd4577752009-11-21 02:48:11 +0000277static inline int32_t SkMin32(int32_t a, int32_t b) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000278 if (a > b)
279 a = b;
280 return a;
281}
282
reed@android.comd4577752009-11-21 02:48:11 +0000283static inline int32_t SkSign32(int32_t a) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000284 return (a >> 31) | ((unsigned) -a >> 31);
285}
286
reed@android.comd4577752009-11-21 02:48:11 +0000287static inline int32_t SkFastMin32(int32_t value, int32_t max) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000288#ifdef SK_CPU_HAS_CONDITIONAL_INSTR
289 if (value > max)
290 value = max;
291 return value;
292#else
293 int diff = max - value;
294 // clear diff if it is negative (clear if value > max)
295 diff &= (diff >> 31);
296 return value + diff;
297#endif
298}
299
300/** Returns signed 32 bit value pinned between min and max, inclusively
301*/
reed@android.comd4577752009-11-21 02:48:11 +0000302static inline int32_t SkPin32(int32_t value, int32_t min, int32_t max) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000303#ifdef SK_CPU_HAS_CONDITIONAL_INSTR
304 if (value < min)
305 value = min;
306 if (value > max)
307 value = max;
308#else
309 if (value < min)
310 value = min;
311 else if (value > max)
312 value = max;
313#endif
314 return value;
315}
316
reed@android.comd4577752009-11-21 02:48:11 +0000317static inline uint32_t SkSetClearShift(uint32_t bits, bool cond,
318 unsigned shift) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000319 SkASSERT((int)cond == 0 || (int)cond == 1);
320 return (bits & ~(1 << shift)) | ((int)cond << shift);
321}
322
reed@android.comd4577752009-11-21 02:48:11 +0000323static inline uint32_t SkSetClearMask(uint32_t bits, bool cond,
324 uint32_t mask) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000325 return cond ? bits | mask : bits & ~mask;
326}
327
reed@google.com1fcd51e2011-01-05 15:50:27 +0000328///////////////////////////////////////////////////////////////////////////////
329
vandebo@chromium.org325cb9a2011-03-30 18:36:29 +0000330/** Use to combine multiple bits in a bitmask in a type safe way.
331 */
332template <typename T>
333T SkTBitOr(T a, T b) {
334 return (T)(a | b);
335}
336
reed@google.com1fcd51e2011-01-05 15:50:27 +0000337/**
338 * Use to cast a pointer to a different type, and maintaining strict-aliasing
339 */
340template <typename Dst> Dst SkTCast(const void* ptr) {
341 union {
342 const void* src;
343 Dst dst;
344 } data;
345 data.src = ptr;
346 return data.dst;
347}
348
reed@android.com8a1c16f2008-12-17 15:59:43 +0000349//////////////////////////////////////////////////////////////////////////////
350
351/** \class SkNoncopyable
352
353SkNoncopyable is the base class for objects that may do not want to
354be copied. It hides its copy-constructor and its assignment-operator.
355*/
ctguil@chromium.org7ffb1b22011-03-15 21:27:08 +0000356class SK_API SkNoncopyable {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000357public:
358 SkNoncopyable() {}
reed@google.com1fcd51e2011-01-05 15:50:27 +0000359
reed@android.com8a1c16f2008-12-17 15:59:43 +0000360private:
361 SkNoncopyable(const SkNoncopyable&);
362 SkNoncopyable& operator=(const SkNoncopyable&);
363};
364
365class SkAutoFree : SkNoncopyable {
366public:
367 SkAutoFree() : fPtr(NULL) {}
368 explicit SkAutoFree(void* ptr) : fPtr(ptr) {}
369 ~SkAutoFree() { sk_free(fPtr); }
reed@google.com1fcd51e2011-01-05 15:50:27 +0000370
reed@android.com8a1c16f2008-12-17 15:59:43 +0000371 /** Return the currently allocate buffer, or null
372 */
373 void* get() const { return fPtr; }
374
375 /** Assign a new ptr allocated with sk_malloc (or null), and return the
376 previous ptr. Note it is the caller's responsibility to sk_free the
377 returned ptr.
378 */
379 void* set(void* ptr) {
380 void* prev = fPtr;
381 fPtr = ptr;
382 return prev;
383 }
reed@google.com1fcd51e2011-01-05 15:50:27 +0000384
reed@android.com8a1c16f2008-12-17 15:59:43 +0000385 /** Transfer ownership of the current ptr to the caller, setting the
386 internal reference to null. Note the caller is reponsible for calling
387 sk_free on the returned address.
388 */
389 void* detach() { return this->set(NULL); }
390
391 /** Free the current buffer, and set the internal reference to NULL. Same
392 as calling sk_free(detach())
393 */
394 void free() {
395 sk_free(fPtr);
396 fPtr = NULL;
397 }
398
399private:
400 void* fPtr;
401 // illegal
402 SkAutoFree(const SkAutoFree&);
403 SkAutoFree& operator=(const SkAutoFree&);
404};
405
bsalomon@google.com7d4679a2011-09-02 22:06:24 +0000406/**
407 * Manage an allocated block of heap memory. This object is the sole manager of
408 * the lifetime of the block, so the caller must not call sk_free() or delete
reed@google.com1c401d82011-10-18 18:52:03 +0000409 * on the block, unless detach() was called.
bsalomon@google.com7d4679a2011-09-02 22:06:24 +0000410 */
411class SkAutoMalloc : public SkNoncopyable {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000412public:
reed@google.com3ab41952011-10-18 18:32:46 +0000413 explicit SkAutoMalloc(size_t size = 0) {
414 fPtr = size ? sk_malloc_throw(size) : NULL;
bsalomon@google.com7d4679a2011-09-02 22:06:24 +0000415 fSize = size;
reed@android.com8a1c16f2008-12-17 15:59:43 +0000416 }
bsalomon@google.com7d4679a2011-09-02 22:06:24 +0000417
418 ~SkAutoMalloc() {
419 sk_free(fPtr);
420 }
421
422 /**
reed@google.com1c401d82011-10-18 18:52:03 +0000423 * Passed to reset to specify what happens if the requested size is smaller
424 * than the current size (and the current block was dynamically allocated).
425 */
426 enum OnShrink {
427 /**
428 * If the requested size is smaller than the current size, and the
429 * current block is dynamically allocated, free the old block and
430 * malloc a new block of the smaller size.
431 */
432 kAlloc_OnShrink,
433
434 /**
435 * If the requested size is smaller than the current size, and the
436 * current block is dynamically allocated, just return the old
437 * block.
438 */
439 kReuse_OnShrink,
440 };
441
442 /**
bsalomon@google.com7d4679a2011-09-02 22:06:24 +0000443 * Reallocates the block to a new size. The ptr may or may not change.
444 */
reed@google.com1c401d82011-10-18 18:52:03 +0000445 void* reset(size_t size, OnShrink shrink = kAlloc_OnShrink) {
446 if (size == fSize || (kReuse_OnShrink == shrink && size < fSize)) {
447 return fPtr;
bsalomon@google.com7d4679a2011-09-02 22:06:24 +0000448 }
reed@google.com1c401d82011-10-18 18:52:03 +0000449
450 sk_free(fPtr);
451 fPtr = size ? sk_malloc_throw(size) : NULL;
452 fSize = size;
453
bsalomon@google.com7d4679a2011-09-02 22:06:24 +0000454 return fPtr;
455 }
456
457 /**
458 * Releases the block back to the heap
459 */
460 void free() {
461 this->reset(0);
462 }
463
464 /**
465 * Return the allocated block.
466 */
467 void* get() { return fPtr; }
468 const void* get() const { return fPtr; }
469
bsalomon@google.com6dcd27c2011-09-06 15:02:33 +0000470 /** Transfer ownership of the current ptr to the caller, setting the
471 internal reference to null. Note the caller is reponsible for calling
472 sk_free on the returned address.
473 */
474 void* detach() {
475 void* ptr = fPtr;
476 fPtr = NULL;
477 fSize = 0;
478 return ptr;
479 }
480
bsalomon@google.com7d4679a2011-09-02 22:06:24 +0000481private:
482 void* fPtr;
reed@google.com1c401d82011-10-18 18:52:03 +0000483 size_t fSize; // can be larger than the requested size (see kReuse)
reed@android.com8a1c16f2008-12-17 15:59:43 +0000484};
485
reed@google.com63a60602011-03-10 13:07:35 +0000486/**
487 * Manage an allocated block of memory. If the requested size is <= kSize, then
488 * the allocation will come from the stack rather than the heap. This object
489 * is the sole manager of the lifetime of the block, so the caller must not
490 * call sk_free() or delete on the block.
491 */
reed@android.com8a1c16f2008-12-17 15:59:43 +0000492template <size_t kSize> class SkAutoSMalloc : SkNoncopyable {
493public:
reed@google.com63a60602011-03-10 13:07:35 +0000494 /**
495 * Creates initially empty storage. get() returns a ptr, but it is to
bsalomon@google.com7d4679a2011-09-02 22:06:24 +0000496 * a zero-byte allocation. Must call reset(size) to return an allocated
reed@google.com63a60602011-03-10 13:07:35 +0000497 * block.
498 */
499 SkAutoSMalloc() {
500 fPtr = fStorage;
reed@google.com1c401d82011-10-18 18:52:03 +0000501 fSize = 0;
reed@android.com8a1c16f2008-12-17 15:59:43 +0000502 }
reed@google.com63a60602011-03-10 13:07:35 +0000503
504 /**
505 * Allocate a block of the specified size. If size <= kSize, then the
506 * allocation will come from the stack, otherwise it will be dynamically
507 * allocated.
508 */
509 explicit SkAutoSMalloc(size_t size) {
510 fPtr = fStorage;
reed@google.com7a17e3a2011-10-18 18:58:06 +0000511 fSize = 0;
bsalomon@google.com7d4679a2011-09-02 22:06:24 +0000512 this->reset(size);
reed@google.com63a60602011-03-10 13:07:35 +0000513 }
514
515 /**
516 * Free the allocated block (if any). If the block was small enought to
517 * have been allocated on the stack (size <= kSize) then this does nothing.
518 */
519 ~SkAutoSMalloc() {
520 if (fPtr != (void*)fStorage) {
reed@android.com8a1c16f2008-12-17 15:59:43 +0000521 sk_free(fPtr);
reed@google.com63a60602011-03-10 13:07:35 +0000522 }
reed@android.com8a1c16f2008-12-17 15:59:43 +0000523 }
reed@google.com63a60602011-03-10 13:07:35 +0000524
525 /**
526 * Return the allocated block. May return non-null even if the block is
527 * of zero size. Since this may be on the stack or dynamically allocated,
528 * the caller must not call sk_free() on it, but must rely on SkAutoSMalloc
529 * to manage it.
530 */
reed@android.com8a1c16f2008-12-17 15:59:43 +0000531 void* get() const { return fPtr; }
reed@google.com63a60602011-03-10 13:07:35 +0000532
533 /**
534 * Return a new block of the requested size, freeing (as necessary) any
535 * previously allocated block. As with the constructor, if size <= kSize
536 * then the return block may be allocated locally, rather than from the
537 * heap.
538 */
reed@google.com1c401d82011-10-18 18:52:03 +0000539 void* reset(size_t size,
540 SkAutoMalloc::OnShrink shrink = SkAutoMalloc::kAlloc_OnShrink) {
541 if (size == fSize || (SkAutoMalloc::kReuse_OnShrink == shrink &&
542 size < fSize)) {
543 return fPtr;
544 }
545
reed@google.com63a60602011-03-10 13:07:35 +0000546 if (fPtr != (void*)fStorage) {
547 sk_free(fPtr);
548 }
549
550 if (size <= kSize) {
551 fPtr = fStorage;
552 } else {
553 fPtr = sk_malloc_flags(size, SK_MALLOC_THROW | SK_MALLOC_TEMP);
554 }
555 return fPtr;
556 }
557
reed@android.com8a1c16f2008-12-17 15:59:43 +0000558private:
559 void* fPtr;
reed@google.com1c401d82011-10-18 18:52:03 +0000560 size_t fSize; // can be larger than the requested size (see kReuse)
reed@android.com8a1c16f2008-12-17 15:59:43 +0000561 uint32_t fStorage[(kSize + 3) >> 2];
reed@android.com8a1c16f2008-12-17 15:59:43 +0000562};
563
564#endif /* C++ */
565
566#endif