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

Side by Side Diff: courgette/encoded_program.cc

Issue 857153003: Use "static_assert" in lieu of "COMPILE_ASSERT" in courgete (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « courgette/difference_estimator.cc ('k') | courgette/third_party/bsdiff_apply.cc » ('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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium 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 #include "courgette/encoded_program.h" 5 #include "courgette/encoded_program.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 693
694 // RelocBlock has the layout of a block of relocations in the base relocation 694 // RelocBlock has the layout of a block of relocations in the base relocation
695 // table file format. 695 // table file format.
696 // 696 //
697 struct RelocBlockPOD { 697 struct RelocBlockPOD {
698 uint32 page_rva; 698 uint32 page_rva;
699 uint32 block_size; 699 uint32 block_size;
700 uint16 relocs[4096]; // Allow up to one relocation per byte of a 4k page. 700 uint16 relocs[4096]; // Allow up to one relocation per byte of a 4k page.
701 }; 701 };
702 702
703 COMPILE_ASSERT(offsetof(RelocBlockPOD, relocs) == 8, reloc_block_header_size); 703 static_assert(offsetof(RelocBlockPOD, relocs) == 8, "reloc block header size");
704 704
705 class RelocBlock { 705 class RelocBlock {
706 public: 706 public:
707 RelocBlock() { 707 RelocBlock() {
708 pod.page_rva = 0xFFFFFFFF; 708 pod.page_rva = 0xFFFFFFFF;
709 pod.block_size = 8; 709 pod.block_size = 8;
710 } 710 }
711 711
712 void Add(uint16 item) { 712 void Add(uint16 item) {
713 pod.relocs[(pod.block_size-8)/2] = item; 713 pod.relocs[(pod.block_size-8)/2] = item;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 if (assembled) 788 if (assembled)
789 return C_OK; 789 return C_OK;
790 return C_ASSEMBLY_FAILED; 790 return C_ASSEMBLY_FAILED;
791 } 791 }
792 792
793 void DeleteEncodedProgram(EncodedProgram* encoded) { 793 void DeleteEncodedProgram(EncodedProgram* encoded) {
794 delete encoded; 794 delete encoded;
795 } 795 }
796 796
797 } // namespace courgette 797 } // namespace courgette
OLDNEW
« no previous file with comments | « courgette/difference_estimator.cc ('k') | courgette/third_party/bsdiff_apply.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698