Skip to content

Commit 2d6c196

Browse files
committed
fix: use 0-based index
Signed-off-by: usamoi <[email protected]>
1 parent 0c57ad4 commit 2d6c196

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/datatype/text_svecf32.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ fn _vectors_svecf32_out(vector: SVecf32Input<'_>) -> CString {
4848
for (&index, &value) in svec.indexes().iter().zip(svec.values().iter()) {
4949
match need_splitter {
5050
true => {
51-
buffer.push_str(format!("{}:{}", index + 1, value).as_str());
51+
buffer.push_str(format!("{}:{}", index, value).as_str());
5252
need_splitter = false;
5353
}
54-
false => buffer.push_str(format!(", {}:{}", index + 1, value).as_str()),
54+
false => buffer.push_str(format!(", {}:{}", index, value).as_str()),
5555
}
5656
}
5757
buffer.push_str(format!("}}/{}", dims).as_str());

src/utils/parse.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ where
165165
let s = unsafe { std::str::from_utf8_unchecked(&token[1..]) };
166166
index = s
167167
.parse::<usize>()
168-
.map_err(|_| ParseVectorError::BadParsing { position })?
169-
- 1;
168+
.map_err(|_| ParseVectorError::BadParsing { position })?;
170169
token.clear();
171170
} else {
172171
return Err(ParseVectorError::TooShortNumber { position });

0 commit comments

Comments
 (0)