Skip to content

Commit e042636

Browse files
committed
ps_ptr pt18
1 parent e042a8f commit e042636

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/psram_unique_ptr.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ class ps_ptr {
6666
void alloc() {
6767
alloc(sizeof(T));
6868
}
69+
// —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
70+
// 📌📌📌 A L L O C _ A R R A Y 📌📌📌
71+
72+
void alloc_array(std::size_t count, const char* name = nullptr) {
73+
alloc(sizeof(T) * count, name);
74+
clear();
75+
}
6976
// —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
7077
// 📌📌📌 R E A L L O C 📌📌📌
7178

src/vorbis_decoder/vorbis_decoder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1784,10 +1784,10 @@ int32_t mapping_inverse(vorbis_info_mapping_t *info) {
17841784
int32_t i, j;
17851785
int32_t n = s_blocksizes[s_dsp_state->W];
17861786

1787-
ps_ptr<int32_t*> pcmbundle; pcmbundle.alloc(sizeof(int32_t*) * s_vorbisChannels); pcmbundle.clear();
1787+
ps_ptr<int32_t*> pcmbundle; pcmbundle.alloc_array(s_vorbisChannels); pcmbundle.clear();
17881788
ps_ptr<int32_t> zerobundle; zerobundle.alloc(sizeof(int32_t) * s_vorbisChannels);
17891789
ps_ptr<int32_t> nonzero; nonzero.alloc(sizeof(int32_t) * s_vorbisChannels);
1790-
ps_ptr<int32_t*> floormemo; floormemo.alloc(sizeof(int32_t*) * s_vorbisChannels); floormemo.clear();
1790+
ps_ptr<int32_t*> floormemo; floormemo.alloc_array(s_vorbisChannels);
17911791

17921792
/* recover the spectral envelope; store it in the PCM vector for now */
17931793
for(i = 0; i < s_vorbisChannels; i++) {

0 commit comments

Comments
 (0)