Skip to content

Commit

Permalink
Save more flash ... we should be at a net negative now
Browse files Browse the repository at this point in the history
  • Loading branch information
andy31415 committed Jan 15, 2025
1 parent b83a3bb commit 764095f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/app/AttributeValueEncoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ class AttributeValueEncoder
return mAttributeValueEncoder.EncodeListItem(std::forward<T>(aArg));
}

// overrides that save flash: no need to care about the extra const
// Without this, we have a usage of:
// chip::ChipError chip::app::AttributeValueEncoder::EncodeListItem<unsigned long const&>
// that uses 162 bytes of flash on ARM32 (at least on QPG)
//
// TODO:
// - we should figure where the extra const override is used
// - we should try to avoid having such footguns. This list template-explosion seems
// dangerous for flash.
CHIP_ERROR Encode(uint32_t const & aArg) const { return Encode((uint32_t &) aArg); }

private:
AttributeValueEncoder & mAttributeValueEncoder;
};
Expand Down

0 comments on commit 764095f

Please sign in to comment.