micro_string.h 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. /* Copyright 2018 The TensorFlow Authors. All Rights Reserved.
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.
  11. ==============================================================================*/
  12. #ifndef TENSORFLOW_LITE_MICRO_MICRO_STRING_H_
  13. #define TENSORFLOW_LITE_MICRO_MICRO_STRING_H_
  14. #include <cstdarg>
  15. // Implements simple string formatting for numeric types. Returns the number of
  16. // bytes written to output.
  17. extern "C" {
  18. // Functionally equivalent to vsnprintf, trimmed down for TFLite Micro.
  19. // MicroSnprintf() is implemented using MicroVsnprintf().
  20. int MicroVsnprintf(char* output, int len, const char* format, va_list args);
  21. // Functionally equavalent to snprintf, trimmed down for TFLite Micro.
  22. // For example, MicroSnprintf(buffer, 10, "int %d", 10) will put the string
  23. // "int 10" in the buffer.
  24. // Floating point values are logged in exponent notation (1.XXX*2^N).
  25. int MicroSnprintf(char* output, int len, const char* format, ...);
  26. }
  27. #endif // TENSORFLOW_LITE_MICRO_MICRO_STRING_H_