Skip to content

Commit 660c7d8

Browse files
committed
Optimized Print::print(String&) (part 2)
1 parent 88a2ca1 commit 660c7d8

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

build/shared/revisions.txt

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ ARDUINO 1.5.6 BETA
1111
[core]
1212
* sam: Fixed wrap-around bug in delay() (Mark Tillotson)
1313
* sam: Fixed regression in analogRead() (fails to read multiple channels) (Mark Tillotson)
14+
* Optimized Print::print(String&) method, now uses internal string buffer to perform block write
1415

1516
ARDUINO 1.5.5 BETA 2013.11.28
1617

hardware/arduino/sam/cores/arduino/Print.cpp

+1-5
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,7 @@ size_t Print::print(const __FlashStringHelper *ifsh)
4646

4747
size_t Print::print(const String &s)
4848
{
49-
size_t n = 0;
50-
for (uint16_t i = 0; i < s.length(); i++) {
51-
n += write(s[i]);
52-
}
53-
return n;
49+
return write(reinterpret_cast<const uint8_t*>(s.c_str()), s.length());
5450
}
5551

5652
size_t Print::print(const char str[])

0 commit comments

Comments
 (0)