src/FixedArray.h
changeset 161 b3f0aaee735a
parent 86 32ad0523b309
child 188 bab29bcec7fe
     1.1 --- a/src/FixedArray.h	Sun Aug 05 01:28:12 2012 -0700
     1.2 +++ b/src/FixedArray.h	Sun Aug 05 01:45:37 2012 -0700
     1.3 @@ -1,20 +1,20 @@
     1.4 -/* vim: set ts=4 sw=4 tw=99 et
     1.5 +/* vim: set ts=4 sw=4 tw=99 et:
     1.6   *
     1.7   * Copyright (C) 2012 David Anderson
     1.8   *
     1.9 - * This file is part of JITCraft.
    1.10 + * This file is part of SourcePawn.
    1.11   *
    1.12 - * JITCraft is free software: you can redistribute it and/or modify it under
    1.13 + * SourcePawn is free software: you can redistribute it and/or modify it under
    1.14   * the terms of the GNU General Public License as published by the Free
    1.15   * Software Foundation, either version 3 of the License, or (at your option)
    1.16   * any later version.
    1.17   * 
    1.18 - * Foobar is distributed in the hope that it will be useful, but WITHOUT ANY
    1.19 + * SourcePawn is distributed in the hope that it will be useful, but WITHOUT ANY
    1.20   * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    1.21   * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
    1.22   *
    1.23   * You should have received a copy of the GNU General Public License along with
    1.24 - * JITCraft. If not, see http://www.gnu.org/licenses/.
    1.25 + * SourcePawn. If not, see http://www.gnu.org/licenses/.
    1.26   */
    1.27  #ifndef _include_jitcraft_fixedarray_h_
    1.28  #define _include_jitcraft_fixedarray_h_
    1.29 @@ -47,6 +47,9 @@
    1.30          assert(i < length());
    1.31          write(zone, &vec()[i], obj);
    1.32      }
    1.33 +    size_t objSize() {
    1.34 +        return SizeFor(length());
    1.35 +    }
    1.36  
    1.37      static size_t SizeFor(unsigned length) {
    1.38          return sizeof(FixedArray) + sizeof(Object *) * length;
    1.39 @@ -73,9 +76,12 @@
    1.40      Address raw() {
    1.41          return reinterpret_cast<uint8 *>(this + 1);
    1.42      }
    1.43 +    size_t objSize() {
    1.44 +        return SizeFor(length());
    1.45 +    }
    1.46  
    1.47      static size_t SizeFor(unsigned length) {
    1.48 -        return Align(sizeof(ByteArray) + sizeof(uint8) * length, kObjectAlignment);
    1.49 +        return sizeof(ByteArray) + sizeof(uint8) * length;
    1.50      }
    1.51  
    1.52      static inline ByteArray *cast(Object *obj) {