Skip to content

Commit

Permalink
Update index vs layout_index upb docs
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 690813728
  • Loading branch information
honglooker authored and copybara-github committed Oct 29, 2024
1 parent 1aff4ad commit 367ef9c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion upb/reflection/def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,13 @@ class FieldDefPtr {
// whatever message this field belongs to. Guaranteed to be less than
// f->containing_type()->field_count(). May only be accessed once the def has
// been finalized.
// The index ordering here is *dependent* on the order of the fields in the
// .proto file.
uint32_t index() const { return upb_FieldDef_Index(ptr_); }

// Index into msgdef->layout->fields or file->exts
// Index into msgdef->layout->fields or file->exts.
// This is the index that the MiniTable uses, and is independent of the order
// of the fields in the .proto file.
uint32_t layout_index() const { return upb_FieldDef_LayoutIndex(ptr_); }

// The MessageDef to which this field belongs (for extensions, the extended
Expand Down

0 comments on commit 367ef9c

Please sign in to comment.