Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: xfa/fxbarcode/common/BC_CommonBitArray.cpp

Issue 2649563003: Replace CFX_ByteArray with CFX_ArrayTemplate<uint8_t> (Closed)
Patch Set: re-upload Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxbarcode/common/BC_CommonBitArray.h ('k') | xfa/fxbarcode/common/BC_CommonByteArray.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 // Original code is licensed as follows: 6 // Original code is licensed as follows:
7 /* 7 /*
8 * Copyright 2007 ZXing authors 8 * Copyright 2007 ZXing authors
9 * 9 *
10 * Licensed under the Apache License, Version 2.0 (the "License"); 10 * Licensed under the Apache License, Version 2.0 (the "License");
(...skipping 23 matching lines...) Expand all
34 CBC_CommonBitArray::CBC_CommonBitArray(int32_t size) { 34 CBC_CommonBitArray::CBC_CommonBitArray(int32_t size) {
35 m_bits.SetSize((size + 31) >> 5); 35 m_bits.SetSize((size + 31) >> 5);
36 m_size = size; 36 m_size = size;
37 } 37 }
38 CBC_CommonBitArray::~CBC_CommonBitArray() { 38 CBC_CommonBitArray::~CBC_CommonBitArray() {
39 m_size = 0; 39 m_size = 0;
40 } 40 }
41 int32_t CBC_CommonBitArray::GetSize() { 41 int32_t CBC_CommonBitArray::GetSize() {
42 return m_size; 42 return m_size;
43 } 43 }
44 CFX_Int32Array& CBC_CommonBitArray::GetBits() { 44 CFX_ArrayTemplate<int32_t>& CBC_CommonBitArray::GetBits() {
45 return m_bits; 45 return m_bits;
46 } 46 }
47 int32_t CBC_CommonBitArray::GetSizeInBytes() { 47 int32_t CBC_CommonBitArray::GetSizeInBytes() {
48 return (m_size + 7) >> 3; 48 return (m_size + 7) >> 3;
49 } 49 }
50 bool CBC_CommonBitArray::Get(int32_t i) { 50 bool CBC_CommonBitArray::Get(int32_t i) {
51 return (m_bits[i >> 5] & (1 << (i & 0x1f))) != 0; 51 return (m_bits[i >> 5] & (1 << (i & 0x1f))) != 0;
52 } 52 }
53 void CBC_CommonBitArray::Set(int32_t i) { 53 void CBC_CommonBitArray::Set(int32_t i) {
54 m_bits[i >> 5] |= 1 << (i & 0x1F); 54 m_bits[i >> 5] |= 1 << (i & 0x1F);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 int32_t size = m_size; 104 int32_t size = m_size;
105 int32_t i; 105 int32_t i;
106 for (i = 0; i < size; i++) { 106 for (i = 0; i < size; i++) {
107 if (Get(size - i - 1)) { 107 if (Get(size - i - 1)) {
108 newBits[i >> 5] |= 1 << (i & 0x1F); 108 newBits[i >> 5] |= 1 << (i & 0x1F);
109 } 109 }
110 } 110 }
111 FXSYS_memcpy(&m_bits[0], newBits, m_bits.GetSize() * sizeof(int32_t)); 111 FXSYS_memcpy(&m_bits[0], newBits, m_bits.GetSize() * sizeof(int32_t));
112 FX_Free(newBits); 112 FX_Free(newBits);
113 } 113 }
OLDNEW
« no previous file with comments | « xfa/fxbarcode/common/BC_CommonBitArray.h ('k') | xfa/fxbarcode/common/BC_CommonByteArray.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698